repo_name
stringclasses
6 values
pr_number
int64
512
78.9k
pr_title
stringlengths
3
144
pr_description
stringlengths
0
30.3k
author
stringlengths
2
21
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
17
30.4k
filepath
stringlengths
9
210
before_content
stringlengths
0
112M
after_content
stringlengths
0
112M
label
int64
-1
1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // // System.Reflection.Emit/ModuleBuilder.cs // // Author: // Paolo Molaro ([email protected]) // // (C) 2001 Ximian, Inc. http://www.ximian.com // #if MONO_FEATURE_SRE using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.IO; using System.Globalization; namespace System.Reflection.Emit { [StructLayout(LayoutKind.Sequential)] public partial class ModuleBuilder : Module { #region Sync with MonoReflectionModuleBuilder in object-internals.h #region This class inherits from Module, but the runtime expects it to have the same layout as MonoModule internal IntPtr _impl; /* a pointer to a MonoImage */ internal Assembly assembly; internal string fqname; internal string name; internal string scopename; internal bool is_resource; internal int token; #endregion private UIntPtr dynamic_image; /* GC-tracked */ private int num_types; private TypeBuilder[]? types; private CustomAttributeBuilder[]? cattrs; private int table_idx; internal AssemblyBuilder assemblyb; private object[]? global_methods; private object[]? global_fields; private bool is_main; private object? resources; private IntPtr unparented_classes; private int[]? table_indexes; #endregion private byte[] guid; private TypeBuilder? global_type; private Type? global_type_created; // name_cache keys are display names private Dictionary<ITypeName, TypeBuilder> name_cache; private Dictionary<string, int> us_string_cache; private ModuleBuilderTokenGenerator? token_gen; [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void basic_init(ModuleBuilder ab); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void set_wrappers_type(ModuleBuilder mb, Type? ab); [DynamicDependency(nameof(table_indexes))] // Automatically keeps all previous fields too due to StructLayout internal ModuleBuilder(AssemblyBuilder assb, string name) { this.name = this.scopename = name; this.fqname = name; this.assembly = this.assemblyb = assb; guid = Guid.NewGuid().ToByteArray(); table_idx = get_next_table_index(0x00, 1); name_cache = new Dictionary<ITypeName, TypeBuilder>(); us_string_cache = new Dictionary<string, int>(512); basic_init(this); CreateGlobalType(); TypeBuilder tb = new TypeBuilder(this, TypeAttributes.Abstract, 0xFFFFFF); /*last valid token*/ Type? type = tb.CreateType(); set_wrappers_type(this, type); } [RequiresAssemblyFiles(UnknownStringMessageInRAF)] public override string FullyQualifiedName { get { string fullyQualifiedName = fqname; if (fullyQualifiedName == null) return null!; // FIXME: this should not return null return fullyQualifiedName; } } public void CreateGlobalFunctions() { if (global_type_created != null) throw new InvalidOperationException("global methods already created"); if (global_type != null) global_type_created = global_type.CreateType()!; } public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes) { ArgumentNullException.ThrowIfNull(data); FieldAttributes maskedAttributes = attributes & ~FieldAttributes.ReservedMask; FieldBuilder fb = DefineDataImpl(name, data.Length, maskedAttributes | FieldAttributes.HasFieldRVA); fb.SetRVAData(data); return fb; } public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes) { return DefineDataImpl(name, size, attributes & ~FieldAttributes.ReservedMask); } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Reflection.Emit is not subject to trimming")] private FieldBuilder DefineDataImpl(string name, int size, FieldAttributes attributes) { ArgumentException.ThrowIfNullOrEmpty(name); if (global_type_created != null) throw new InvalidOperationException("global fields already created"); if ((size <= 0) || (size >= 0x3f0000)) throw new ArgumentException("Data size must be > 0 and < 0x3f0000", null as string); CreateGlobalType(); string typeName = "$ArrayType$" + size; Type? datablobtype = GetType(typeName, false, false); if (datablobtype == null) { TypeBuilder tb = DefineType(typeName, TypeAttributes.Public | TypeAttributes.ExplicitLayout | TypeAttributes.Sealed, typeof(ValueType), null, FieldBuilder.RVADataPackingSize(size), size); tb.CreateType(); datablobtype = tb; } FieldBuilder fb = global_type!.DefineField(name, datablobtype, attributes | FieldAttributes.Static); if (global_fields != null) { FieldBuilder[] new_fields = new FieldBuilder[global_fields.Length + 1]; Array.Copy(global_fields, new_fields, global_fields.Length); new_fields[global_fields.Length] = fb; global_fields = new_fields; } else { global_fields = new FieldBuilder[] { fb }; } return fb; } private void addGlobalMethod(MethodBuilder mb) { if (global_methods != null) { MethodBuilder[] new_methods = new MethodBuilder[global_methods.Length + 1]; Array.Copy(global_methods, new_methods, global_methods.Length); new_methods[global_methods.Length] = mb; global_methods = new_methods; } else { global_methods = new MethodBuilder[] { mb }; } } public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers) { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) throw new ArgumentException("global methods must be static"); if (global_type_created != null) throw new InvalidOperationException("global methods already created"); CreateGlobalType(); MethodBuilder mb = global_type!.DefineMethod(name, attributes, callingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); addGlobalMethod(mb); return mb; } [RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")] public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) throw new ArgumentException("global methods must be static"); if (global_type_created != null) throw new InvalidOperationException("global methods already created"); CreateGlobalType(); MethodBuilder mb = global_type!.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); addGlobalMethod(mb); return mb; } private void AddType(TypeBuilder tb) { if (types != null) { if (types.Length == num_types) { TypeBuilder[] new_types = new TypeBuilder[types.Length * 2]; Array.Copy(types, new_types, num_types); types = new_types; } } else { types = new TypeBuilder[1]; } types[num_types] = tb; num_types++; } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "Reflection.Emit is not subject to trimming")] private TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize) { ArgumentNullException.ThrowIfNull(name, "fullname"); ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) throw new ArgumentException("Duplicate type name within an assembly."); TypeBuilder res = new TypeBuilder(this, name, attr, parent, interfaces, packingSize, typesize, null); AddType(res); name_cache.Add(ident, res); return res; } internal void RegisterTypeName(TypeBuilder tb, ITypeName name) { name_cache.Add(name, tb); } internal TypeBuilder? GetRegisteredType(ITypeName name) { TypeBuilder? result; name_cache.TryGetValue(name, out result); return result; } public TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces) { return DefineType(name, attr, parent, interfaces, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize); } public TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packingSize, int typesize) { return DefineType(name, attr, parent, null, packingSize, typesize); } public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes) { return new MonoArrayMethod(arrayClass, methodName, callingConvention, returnType!, parameterTypes!); // FIXME: nulls should be allowed } public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType) { ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) throw new ArgumentException("Duplicate type name within an assembly."); EnumBuilder eb = new EnumBuilder(this, name, visibility, underlyingType); TypeBuilder res = eb.GetTypeBuilder(); AddType(res); name_cache.Add(ident, res); return eb; } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className) { return GetType(className, false, false); } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className, bool ignoreCase) { return GetType(className, false, ignoreCase); } private static TypeBuilder? search_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className) { int i; for (i = 0; i < validElementsInArray; ++i) { if (string.Compare(className.DisplayName, arr[i].FullName, true, CultureInfo.InvariantCulture) == 0) { return arr[i]; } } return null; } private static TypeBuilder? search_nested_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className) { int i; for (i = 0; i < validElementsInArray; ++i) { if (string.Compare(className.DisplayName, arr[i].Name, true, CultureInfo.InvariantCulture) == 0) return arr[i]; } return null; } private static TypeBuilder? GetMaybeNested(TypeBuilder t, IEnumerable<ITypeName> nested) { TypeBuilder? result = t; foreach (ITypeName pname in nested) { if (result.subtypes == null) return null; result = search_nested_in_array(result.subtypes, result.subtypes.Length, pname); if (result == null) return null; } return result; } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className, bool throwOnError, bool ignoreCase) { ArgumentException.ThrowIfNullOrEmpty(className); TypeBuilder? result = null; if (types == null && throwOnError) throw new TypeLoadException(className); TypeSpec ts = TypeSpec.Parse(className); if (!ignoreCase) { ITypeName displayNestedName = ts.TypeNameWithoutModifiers(); name_cache.TryGetValue(displayNestedName, out result); } else { if (types != null) result = search_in_array(types, num_types, ts.Name!); if (!ts.IsNested && result != null) { result = GetMaybeNested(result, ts.Nested); } } if ((result == null) && throwOnError) throw new TypeLoadException(className); if (result != null && (ts.HasModifiers || ts.IsByRef)) { Type mt = result; if (result is TypeBuilder) { var tb = result as TypeBuilder; if (tb.is_created) mt = tb.CreateType()!; } foreach (IModifierSpec mod in ts.Modifiers) { if (mod is PointerSpec) mt = mt.MakePointerType()!; else if (mod is IArraySpec) { var spec = (mod as IArraySpec)!; if (spec.IsBound) return null; if (spec.Rank == 1) mt = mt.MakeArrayType(); else mt = mt.MakeArrayType(spec.Rank); } } if (ts.IsByRef) mt = mt.MakeByRefType(); result = mt as TypeBuilder; if (result == null) return mt; } if (result != null && result.is_created) return result.CreateType(); else return result; } internal int get_next_table_index(int table, int count) { if (table_indexes == null) { table_indexes = new int[64]; for (int i = 0; i < 64; ++i) table_indexes[i] = 1; /* allow room for .<Module> in TypeDef table */ table_indexes[0x02] = 2; } // Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString()); int index = table_indexes[table]; table_indexes[table] += count; return index; } public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { ArgumentNullException.ThrowIfNull(customBuilder); if (cattrs != null) { CustomAttributeBuilder[] new_array = new CustomAttributeBuilder[cattrs.Length + 1]; cattrs.CopyTo(new_array, 0); new_array[cattrs.Length] = customBuilder; cattrs = new_array; } else { cattrs = new CustomAttributeBuilder[1]; cattrs[0] = customBuilder; } } public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute)); } /* internal ISymbolDocumentWriter? DefineDocument (string url, Guid language, Guid languageVendor, Guid documentType) { if (symbolWriter != null) return symbolWriter.DefineDocument (url, language, languageVendor, documentType); else return null; } */ [RequiresUnreferencedCode("Types might be removed")] public override Type[] GetTypes() { if (types == null) return Type.EmptyTypes; int n = num_types; Type[] copy = new Type[n]; Array.Copy(types, copy, n); // MS replaces the typebuilders with their created types for (int i = 0; i < copy.Length; ++i) if (types[i].is_created) copy[i] = types[i].CreateType()!; return copy; } internal static int GetMethodToken(MethodInfo method) { ArgumentNullException.ThrowIfNull(method); return method.MetadataToken; } internal int GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes) { return GetMethodToken(GetArrayMethod(arrayClass, methodName, callingConvention, returnType, parameterTypes)); } internal static int GetConstructorToken(ConstructorInfo con) { ArgumentNullException.ThrowIfNull(con); return con.MetadataToken; } internal static int GetFieldToken(FieldInfo field) { ArgumentNullException.ThrowIfNull(field); return field.MetadataToken; } // FIXME: internal int GetSignatureToken(byte[] sigBytes, int sigLength) { throw new NotImplementedException(); } internal int GetSignatureToken(SignatureHelper sigHelper) { ArgumentNullException.ThrowIfNull(sigHelper); return GetToken(sigHelper); } internal int GetStringConstant(string str) { ArgumentNullException.ThrowIfNull(str); return GetToken(str); } internal static int GetTypeToken(Type type) { ArgumentNullException.ThrowIfNull(type); if (type.IsByRef) throw new ArgumentException("type can't be a byref type", nameof(type)); return type.MetadataToken; } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Reflection.Emit is not subject to trimming")] internal int GetTypeToken(string name) { return GetTypeToken(GetType(name)!); } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getUSIndex(ModuleBuilder mb, string str); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getToken(ModuleBuilder mb, object obj, bool create_open_instance); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getMethodToken(ModuleBuilder mb, MethodBase method, Type[] opt_param_types); internal int GetToken(string str) { int result; if (!us_string_cache.TryGetValue(str, out result)) { result = getUSIndex(this, str); us_string_cache[str] = result; } return result; } private static int typeref_tokengen = 0x01ffffff; private static int typedef_tokengen = 0x02ffffff; private static int typespec_tokengen = 0x1bffffff; private static int memberref_tokengen = 0x0affffff; private static int methoddef_tokengen = 0x06ffffff; private Dictionary<MemberInfo, int>? inst_tokens, inst_tokens_open; // // Assign a pseudo token to the various TypeBuilderInst objects, so the runtime // doesn't have to deal with them. // For Run assemblies, the tokens will not be fixed up, so the runtime will // still encounter these objects, it will resolve them by calling their // RuntimeResolve () methods. // private int GetPseudoToken(MemberInfo member, bool create_open_instance) { int token; Dictionary<MemberInfo, int>? dict = create_open_instance ? inst_tokens_open : inst_tokens; if (dict == null) { dict = new Dictionary<MemberInfo, int>(ReferenceEqualityComparer.Instance); if (create_open_instance) inst_tokens_open = dict; else inst_tokens = dict; } else if (dict.TryGetValue(member, out token)) { return token; } // Count backwards to avoid collisions with the tokens // allocated by the runtime if (member is TypeBuilderInstantiation || member is SymbolType) token = typespec_tokengen--; else if (member is FieldOnTypeBuilderInst) token = memberref_tokengen--; else if (member is ConstructorOnTypeBuilderInst) token = memberref_tokengen--; else if (member is MethodOnTypeBuilderInst) token = memberref_tokengen--; else if (member is FieldBuilder) token = memberref_tokengen--; else if (member is TypeBuilder tb) { if (create_open_instance && tb.ContainsGenericParameters) token = typespec_tokengen--; else if (member.Module == this) token = typedef_tokengen--; else token = typeref_tokengen--; } else if (member is EnumBuilder eb) { token = GetPseudoToken(eb.GetTypeBuilder(), create_open_instance); dict[member] = token; // n.b. don't register with the runtime, the TypeBuilder already did it. return token; } else if (member is ConstructorBuilder cb) { if (member.Module == this && !cb.TypeBuilder.ContainsGenericParameters) token = methoddef_tokengen--; else token = memberref_tokengen--; } else if (member is MethodBuilder mb) { if (member.Module == this && !mb.TypeBuilder.ContainsGenericParameters && !mb.IsGenericMethodDefinition) token = methoddef_tokengen--; else token = memberref_tokengen--; } else if (member is GenericTypeParameterBuilder) { token = typespec_tokengen--; } else throw new NotImplementedException(); dict[member] = token; RegisterToken(member, token); return token; } internal int GetToken(MemberInfo member) { if (member is ConstructorBuilder || member is MethodBuilder || member is FieldBuilder) return GetPseudoToken(member, false); return getToken(this, member, true); } internal int GetToken(MemberInfo member, bool create_open_instance) { if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder || member is EnumBuilder) return GetPseudoToken(member, create_open_instance); return getToken(this, member, create_open_instance); } internal int GetToken(MethodBase method, IEnumerable<Type> opt_param_types) { if (method is ConstructorBuilder || method is MethodBuilder) return GetPseudoToken(method, false); if (opt_param_types == null) return getToken(this, method, true); var optParamTypes = new List<Type>(opt_param_types); return getMethodToken(this, method, optParamTypes.ToArray()); } internal int GetToken(MethodBase method, Type[] opt_param_types) { if (method is ConstructorBuilder || method is MethodBuilder) return GetPseudoToken(method, false); return getMethodToken(this, method, opt_param_types); } internal int GetToken(SignatureHelper helper) { return getToken(this, helper, true); } /* * Register the token->obj mapping with the runtime so the Module.Resolve... * methods will work for obj. */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void RegisterToken(object obj, int token); /* * Returns MemberInfo registered with the given token. */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern object GetRegisteredToken(int token); internal ITokenGenerator GetTokenGenerator() { if (token_gen == null) token_gen = new ModuleBuilderTokenGenerator(this); return token_gen; } // Called from the runtime to return the corresponding finished reflection object internal static object RuntimeResolve(object obj) { if (obj is MethodBuilder mb) return mb.RuntimeResolve(); if (obj is ConstructorBuilder cb) return cb.RuntimeResolve(); if (obj is FieldBuilder fb) return fb.RuntimeResolve(); if (obj is GenericTypeParameterBuilder gtpb) return gtpb.RuntimeResolve(); if (obj is FieldOnTypeBuilderInst fotbi) return fotbi.RuntimeResolve(); if (obj is MethodOnTypeBuilderInst motbi) return motbi.RuntimeResolve(); if (obj is ConstructorOnTypeBuilderInst cotbi) return cotbi.RuntimeResolve(); if (obj is Type t) return t.RuntimeResolve(); throw new NotImplementedException(obj.GetType().FullName); } internal string FileName { get { return fqname; } } internal bool IsMain { set { is_main = value; } } internal void CreateGlobalType() { if (global_type == null) global_type = new TypeBuilder(this, 0, 1); } public override Assembly Assembly { get { return assemblyb; } } [RequiresAssemblyFiles(UnknownStringMessageInRAF)] public override string Name { get { return name; } } public override string ScopeName { get { return name; } } public override Guid ModuleVersionId { get { return new Guid(guid); } } public override bool IsResource() { return false; } internal ModuleBuilder InternalModule => this; internal IntPtr GetUnderlyingNativeHandle() { return _impl; } [RequiresUnreferencedCode("Methods might be removed")] protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { if (global_type_created == null) return null; if (types == null) return global_type_created.GetMethod(name); return global_type_created.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveField(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveMember(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } internal MemberInfo ResolveOrGetRegisteredToken(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { ResolveTokenError error; MemberInfo? m = RuntimeModule.ResolveMemberToken(_impl, metadataToken, RuntimeModule.ptrs_from_types(genericTypeArguments), RuntimeModule.ptrs_from_types(genericMethodArguments), out error); if (m != null) return m; m = GetRegisteredToken(metadataToken) as MemberInfo; if (m == null) throw RuntimeModule.resolve_token_exception(this, metadataToken, error, "MemberInfo"); else return m; } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveMethod(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override string ResolveString(int metadataToken) { return RuntimeModule.ResolveString(this, _impl, metadataToken); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override byte[] ResolveSignature(int metadataToken) { return RuntimeModule.ResolveSignature(this, _impl, metadataToken); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveType(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } public override bool Equals(object? obj) { return base.Equals(obj); } public override int GetHashCode() { return base.GetHashCode(); } public override bool IsDefined(Type attributeType, bool inherit) { return base.IsDefined(attributeType, inherit); } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(null!, inherit); // FIXME: coreclr doesn't allow null attributeType } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (cattrs == null || cattrs.Length == 0) return Array.Empty<object>(); if (attributeType is TypeBuilder) throw new InvalidOperationException("First argument to GetCustomAttributes can't be a TypeBuilder"); List<object> results = new List<object>(); for (int i = 0; i < cattrs.Length; i++) { Type t = cattrs[i].Ctor.GetType(); if (t is TypeBuilder) throw new InvalidOperationException("Can't construct custom attribute for TypeBuilder type"); if (attributeType == null || attributeType.IsAssignableFrom(t)) results.Add(cattrs[i].Invoke()); } return results.ToArray(); } public override IList<CustomAttributeData> GetCustomAttributesData() { return CustomAttribute.GetCustomAttributesData(this); } [RequiresUnreferencedCode("Fields might be removed")] public override FieldInfo? GetField(string name, BindingFlags bindingAttr) { if (global_type_created == null) throw new InvalidOperationException("Module-level fields cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetField(name, bindingAttr); } [RequiresUnreferencedCode("Fields might be removed")] public override FieldInfo[] GetFields(BindingFlags bindingFlags) { if (global_type_created == null) throw new InvalidOperationException("Module-level fields cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetFields(bindingFlags); } [RequiresUnreferencedCode("Methods might be removed")] public override MethodInfo[] GetMethods(BindingFlags bindingFlags) { if (global_type_created == null) throw new InvalidOperationException("Module-level methods cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetMethods(bindingFlags); } public override int MetadataToken { get { return RuntimeModule.get_MetadataToken(this); } } } internal sealed class ModuleBuilderTokenGenerator : ITokenGenerator { private ModuleBuilder mb; public ModuleBuilderTokenGenerator(ModuleBuilder mb) { this.mb = mb; } public int GetToken(string str) { return mb.GetToken(str); } public int GetToken(MemberInfo member, bool create_open_instance) { return mb.GetToken(member, create_open_instance); } public int GetToken(MethodBase method, Type[] opt_param_types) { return mb.GetToken(method, opt_param_types); } public int GetToken(SignatureHelper helper) { return mb.GetToken(helper); } } } #endif
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // // System.Reflection.Emit/ModuleBuilder.cs // // Author: // Paolo Molaro ([email protected]) // // (C) 2001 Ximian, Inc. http://www.ximian.com // #if MONO_FEATURE_SRE using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.IO; using System.Globalization; namespace System.Reflection.Emit { [StructLayout(LayoutKind.Sequential)] public partial class ModuleBuilder : Module { #region Sync with MonoReflectionModuleBuilder in object-internals.h #region This class inherits from Module, but the runtime expects it to have the same layout as MonoModule internal IntPtr _impl; /* a pointer to a MonoImage */ internal Assembly assembly; internal string fqname; internal string name; internal string scopename; internal bool is_resource; internal int token; #endregion private UIntPtr dynamic_image; /* GC-tracked */ private int num_types; private TypeBuilder[]? types; private CustomAttributeBuilder[]? cattrs; private int table_idx; internal AssemblyBuilder assemblyb; private object[]? global_methods; private object[]? global_fields; private bool is_main; private object? resources; private IntPtr unparented_classes; private int[]? table_indexes; #endregion private byte[] guid; private TypeBuilder? global_type; private Type? global_type_created; // name_cache keys are display names private Dictionary<ITypeName, TypeBuilder> name_cache; private Dictionary<string, int> us_string_cache; private ModuleBuilderTokenGenerator? token_gen; [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void basic_init(ModuleBuilder ab); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void set_wrappers_type(ModuleBuilder mb, Type? ab); [DynamicDependency(nameof(table_indexes))] // Automatically keeps all previous fields too due to StructLayout internal ModuleBuilder(AssemblyBuilder assb, string name) { this.name = this.scopename = name; this.fqname = name; this.assembly = this.assemblyb = assb; guid = Guid.NewGuid().ToByteArray(); table_idx = get_next_table_index(0x00, 1); name_cache = new Dictionary<ITypeName, TypeBuilder>(); us_string_cache = new Dictionary<string, int>(512); basic_init(this); CreateGlobalType(); TypeBuilder tb = new TypeBuilder(this, TypeAttributes.Abstract, 0xFFFFFF); /*last valid token*/ Type? type = tb.CreateType(); set_wrappers_type(this, type); } [RequiresAssemblyFiles(UnknownStringMessageInRAF)] public override string FullyQualifiedName { get { string fullyQualifiedName = fqname; if (fullyQualifiedName == null) return null!; // FIXME: this should not return null return fullyQualifiedName; } } public void CreateGlobalFunctions() { if (global_type_created != null) throw new InvalidOperationException("global methods already created"); if (global_type != null) global_type_created = global_type.CreateType()!; } public FieldBuilder DefineInitializedData(string name, byte[] data, FieldAttributes attributes) { ArgumentNullException.ThrowIfNull(data); FieldAttributes maskedAttributes = attributes & ~FieldAttributes.ReservedMask; FieldBuilder fb = DefineDataImpl(name, data.Length, maskedAttributes | FieldAttributes.HasFieldRVA); fb.SetRVAData(data); return fb; } public FieldBuilder DefineUninitializedData(string name, int size, FieldAttributes attributes) { return DefineDataImpl(name, size, attributes & ~FieldAttributes.ReservedMask); } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Reflection.Emit is not subject to trimming")] private FieldBuilder DefineDataImpl(string name, int size, FieldAttributes attributes) { ArgumentException.ThrowIfNullOrEmpty(name); if (global_type_created != null) throw new InvalidOperationException("global fields already created"); if ((size <= 0) || (size >= 0x3f0000)) throw new ArgumentException("Data size must be > 0 and < 0x3f0000", null as string); CreateGlobalType(); string typeName = "$ArrayType$" + size; Type? datablobtype = GetType(typeName, false, false); if (datablobtype == null) { TypeBuilder tb = DefineType(typeName, TypeAttributes.Public | TypeAttributes.ExplicitLayout | TypeAttributes.Sealed, typeof(ValueType), null, FieldBuilder.RVADataPackingSize(size), size); tb.CreateType(); datablobtype = tb; } FieldBuilder fb = global_type!.DefineField(name, datablobtype, attributes | FieldAttributes.Static); if (global_fields != null) { FieldBuilder[] new_fields = new FieldBuilder[global_fields.Length + 1]; Array.Copy(global_fields, new_fields, global_fields.Length); new_fields[global_fields.Length] = fb; global_fields = new_fields; } else { global_fields = new FieldBuilder[] { fb }; } return fb; } private void addGlobalMethod(MethodBuilder mb) { if (global_methods != null) { MethodBuilder[] new_methods = new MethodBuilder[global_methods.Length + 1]; Array.Copy(global_methods, new_methods, global_methods.Length); new_methods[global_methods.Length] = mb; global_methods = new_methods; } else { global_methods = new MethodBuilder[] { mb }; } } public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers) { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) throw new ArgumentException("global methods must be static"); if (global_type_created != null) throw new InvalidOperationException("global methods already created"); CreateGlobalType(); MethodBuilder mb = global_type!.DefineMethod(name, attributes, callingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers); addGlobalMethod(mb); return mb; } [RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")] public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) { ArgumentNullException.ThrowIfNull(name); if ((attributes & MethodAttributes.Static) == 0) throw new ArgumentException("global methods must be static"); if (global_type_created != null) throw new InvalidOperationException("global methods already created"); CreateGlobalType(); MethodBuilder mb = global_type!.DefinePInvokeMethod(name, dllName, entryName, attributes, callingConvention, returnType, parameterTypes, nativeCallConv, nativeCharSet); addGlobalMethod(mb); return mb; } private void AddType(TypeBuilder tb) { if (types != null) { if (types.Length == num_types) { TypeBuilder[] new_types = new TypeBuilder[types.Length * 2]; Array.Copy(types, new_types, num_types); types = new_types; } } else { types = new TypeBuilder[1]; } types[num_types] = tb; num_types++; } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "Reflection.Emit is not subject to trimming")] private TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize) { ArgumentNullException.ThrowIfNull(name, "fullname"); ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) throw new ArgumentException("Duplicate type name within an assembly."); TypeBuilder res = new TypeBuilder(this, name, attr, parent, interfaces, packingSize, typesize, null); AddType(res); name_cache.Add(ident, res); return res; } internal void RegisterTypeName(TypeBuilder tb, ITypeName name) { name_cache.Add(name, tb); } internal TypeBuilder? GetRegisteredType(ITypeName name) { TypeBuilder? result; name_cache.TryGetValue(name, out result); return result; } public TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces) { return DefineType(name, attr, parent, interfaces, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize); } public TypeBuilder DefineType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packingSize, int typesize) { return DefineType(name, attr, parent, null, packingSize, typesize); } public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes) { return new MonoArrayMethod(arrayClass, methodName, callingConvention, returnType!, parameterTypes!); // FIXME: nulls should be allowed } public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType) { ITypeIdentifier ident = TypeIdentifiers.FromInternal(name); if (name_cache.ContainsKey(ident)) throw new ArgumentException("Duplicate type name within an assembly."); EnumBuilder eb = new EnumBuilder(this, name, visibility, underlyingType); TypeBuilder res = eb.GetTypeBuilder(); AddType(res); name_cache.Add(ident, res); return eb; } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className) { return GetType(className, false, false); } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className, bool ignoreCase) { return GetType(className, false, ignoreCase); } private static TypeBuilder? search_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className) { int i; for (i = 0; i < validElementsInArray; ++i) { if (string.Compare(className.DisplayName, arr[i].FullName, true, CultureInfo.InvariantCulture) == 0) { return arr[i]; } } return null; } private static TypeBuilder? search_nested_in_array(TypeBuilder[] arr, int validElementsInArray, ITypeName className) { int i; for (i = 0; i < validElementsInArray; ++i) { if (string.Compare(className.DisplayName, arr[i].Name, true, CultureInfo.InvariantCulture) == 0) return arr[i]; } return null; } private static TypeBuilder? GetMaybeNested(TypeBuilder t, IEnumerable<ITypeName> nested) { TypeBuilder? result = t; foreach (ITypeName pname in nested) { if (result.subtypes == null) return null; result = search_nested_in_array(result.subtypes, result.subtypes.Length, pname); if (result == null) return null; } return result; } [RequiresUnreferencedCode("Types might be removed")] public override Type? GetType(string className, bool throwOnError, bool ignoreCase) { ArgumentException.ThrowIfNullOrEmpty(className); TypeBuilder? result = null; if (types == null && throwOnError) throw new TypeLoadException(className); TypeSpec ts = TypeSpec.Parse(className); if (!ignoreCase) { ITypeName displayNestedName = ts.TypeNameWithoutModifiers(); name_cache.TryGetValue(displayNestedName, out result); } else { if (types != null) result = search_in_array(types, num_types, ts.Name!); if (!ts.IsNested && result != null) { result = GetMaybeNested(result, ts.Nested); } } if ((result == null) && throwOnError) throw new TypeLoadException(className); if (result != null && (ts.HasModifiers || ts.IsByRef)) { Type mt = result; if (result is TypeBuilder) { var tb = result as TypeBuilder; if (tb.is_created) mt = tb.CreateType()!; } foreach (IModifierSpec mod in ts.Modifiers) { if (mod is PointerSpec) mt = mt.MakePointerType()!; else if (mod is IArraySpec) { var spec = (mod as IArraySpec)!; if (spec.IsBound) return null; if (spec.Rank == 1) mt = mt.MakeArrayType(); else mt = mt.MakeArrayType(spec.Rank); } } if (ts.IsByRef) mt = mt.MakeByRefType(); result = mt as TypeBuilder; if (result == null) return mt; } if (result != null && result.is_created) return result.CreateType(); else return result; } internal int get_next_table_index(int table, int count) { if (table_indexes == null) { table_indexes = new int[64]; for (int i = 0; i < 64; ++i) table_indexes[i] = 1; /* allow room for .<Module> in TypeDef table */ table_indexes[0x02] = 2; } // Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString()); int index = table_indexes[table]; table_indexes[table] += count; return index; } public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { ArgumentNullException.ThrowIfNull(customBuilder); if (cattrs != null) { CustomAttributeBuilder[] new_array = new CustomAttributeBuilder[cattrs.Length + 1]; cattrs.CopyTo(new_array, 0); new_array[cattrs.Length] = customBuilder; cattrs = new_array; } else { cattrs = new CustomAttributeBuilder[1]; cattrs[0] = customBuilder; } } public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute)); } /* internal ISymbolDocumentWriter? DefineDocument (string url, Guid language, Guid languageVendor, Guid documentType) { if (symbolWriter != null) return symbolWriter.DefineDocument (url, language, languageVendor, documentType); else return null; } */ [RequiresUnreferencedCode("Types might be removed")] public override Type[] GetTypes() { if (types == null) return Type.EmptyTypes; int n = num_types; Type[] copy = new Type[n]; Array.Copy(types, copy, n); // MS replaces the typebuilders with their created types for (int i = 0; i < copy.Length; ++i) if (types[i].is_created) copy[i] = types[i].CreateType()!; return copy; } internal static int GetMethodToken(MethodInfo method) { ArgumentNullException.ThrowIfNull(method); return method.MetadataToken; } internal int GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes) { return GetMethodToken(GetArrayMethod(arrayClass, methodName, callingConvention, returnType, parameterTypes)); } internal static int GetConstructorToken(ConstructorInfo con) { ArgumentNullException.ThrowIfNull(con); return con.MetadataToken; } internal static int GetFieldToken(FieldInfo field) { ArgumentNullException.ThrowIfNull(field); return field.MetadataToken; } // FIXME: internal int GetSignatureToken(byte[] sigBytes, int sigLength) { throw new NotImplementedException(); } internal int GetSignatureToken(SignatureHelper sigHelper) { ArgumentNullException.ThrowIfNull(sigHelper); return GetToken(sigHelper); } internal int GetStringConstant(string str) { ArgumentNullException.ThrowIfNull(str); return GetToken(str); } internal static int GetTypeToken(Type type) { ArgumentNullException.ThrowIfNull(type); if (type.IsByRef) throw new ArgumentException("type can't be a byref type", nameof(type)); return type.MetadataToken; } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Reflection.Emit is not subject to trimming")] internal int GetTypeToken(string name) { return GetTypeToken(GetType(name)!); } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getUSIndex(ModuleBuilder mb, string str); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getToken(ModuleBuilder mb, object obj, bool create_open_instance); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern int getMethodToken(ModuleBuilder mb, MethodBase method, Type[] opt_param_types); internal int GetToken(string str) { int result; if (!us_string_cache.TryGetValue(str, out result)) { result = getUSIndex(this, str); us_string_cache[str] = result; } return result; } private static int typeref_tokengen = 0x01ffffff; private static int typedef_tokengen = 0x02ffffff; private static int typespec_tokengen = 0x1bffffff; private static int memberref_tokengen = 0x0affffff; private static int methoddef_tokengen = 0x06ffffff; private Dictionary<MemberInfo, int>? inst_tokens, inst_tokens_open; // // Assign a pseudo token to the various TypeBuilderInst objects, so the runtime // doesn't have to deal with them. // For Run assemblies, the tokens will not be fixed up, so the runtime will // still encounter these objects, it will resolve them by calling their // RuntimeResolve () methods. // private int GetPseudoToken(MemberInfo member, bool create_open_instance) { int token; Dictionary<MemberInfo, int>? dict = create_open_instance ? inst_tokens_open : inst_tokens; if (dict == null) { dict = new Dictionary<MemberInfo, int>(ReferenceEqualityComparer.Instance); if (create_open_instance) inst_tokens_open = dict; else inst_tokens = dict; } else if (dict.TryGetValue(member, out token)) { return token; } // Count backwards to avoid collisions with the tokens // allocated by the runtime if (member is TypeBuilderInstantiation || member is SymbolType) token = typespec_tokengen--; else if (member is FieldOnTypeBuilderInst) token = memberref_tokengen--; else if (member is ConstructorOnTypeBuilderInst) token = memberref_tokengen--; else if (member is MethodOnTypeBuilderInst) token = memberref_tokengen--; else if (member is FieldBuilder) token = memberref_tokengen--; else if (member is TypeBuilder tb) { if (create_open_instance && tb.ContainsGenericParameters) token = typespec_tokengen--; else if (member.Module == this) token = typedef_tokengen--; else token = typeref_tokengen--; } else if (member is EnumBuilder eb) { token = GetPseudoToken(eb.GetTypeBuilder(), create_open_instance); dict[member] = token; // n.b. don't register with the runtime, the TypeBuilder already did it. return token; } else if (member is ConstructorBuilder cb) { if (member.Module == this && !cb.TypeBuilder.ContainsGenericParameters) token = methoddef_tokengen--; else token = memberref_tokengen--; } else if (member is MethodBuilder mb) { if (member.Module == this && !mb.TypeBuilder.ContainsGenericParameters && !mb.IsGenericMethodDefinition) token = methoddef_tokengen--; else token = memberref_tokengen--; } else if (member is GenericTypeParameterBuilder) { token = typespec_tokengen--; } else throw new NotImplementedException(); dict[member] = token; RegisterToken(member, token); return token; } internal int GetToken(MemberInfo member) { if (member is ConstructorBuilder || member is MethodBuilder || member is FieldBuilder) return GetPseudoToken(member, false); return getToken(this, member, true); } internal int GetToken(MemberInfo member, bool create_open_instance) { if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder || member is EnumBuilder) return GetPseudoToken(member, create_open_instance); return getToken(this, member, create_open_instance); } internal int GetToken(MethodBase method, IEnumerable<Type> opt_param_types) { if (method is ConstructorBuilder || method is MethodBuilder) return GetPseudoToken(method, false); if (opt_param_types == null) return getToken(this, method, true); var optParamTypes = new List<Type>(opt_param_types); return getMethodToken(this, method, optParamTypes.ToArray()); } internal int GetToken(MethodBase method, Type[] opt_param_types) { if (method is ConstructorBuilder || method is MethodBuilder) return GetPseudoToken(method, false); return getMethodToken(this, method, opt_param_types); } internal int GetToken(SignatureHelper helper) { return getToken(this, helper, true); } /* * Register the token->obj mapping with the runtime so the Module.Resolve... * methods will work for obj. */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void RegisterToken(object obj, int token); /* * Returns MemberInfo registered with the given token. */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern object GetRegisteredToken(int token); internal ITokenGenerator GetTokenGenerator() { if (token_gen == null) token_gen = new ModuleBuilderTokenGenerator(this); return token_gen; } // Called from the runtime to return the corresponding finished reflection object internal static object RuntimeResolve(object obj) { if (obj is MethodBuilder mb) return mb.RuntimeResolve(); if (obj is ConstructorBuilder cb) return cb.RuntimeResolve(); if (obj is FieldBuilder fb) return fb.RuntimeResolve(); if (obj is GenericTypeParameterBuilder gtpb) return gtpb.RuntimeResolve(); if (obj is FieldOnTypeBuilderInst fotbi) return fotbi.RuntimeResolve(); if (obj is MethodOnTypeBuilderInst motbi) return motbi.RuntimeResolve(); if (obj is ConstructorOnTypeBuilderInst cotbi) return cotbi.RuntimeResolve(); if (obj is Type t) return t.RuntimeResolve(); throw new NotImplementedException(obj.GetType().FullName); } internal string FileName { get { return fqname; } } internal bool IsMain { set { is_main = value; } } internal void CreateGlobalType() { if (global_type == null) global_type = new TypeBuilder(this, 0, 1); } public override Assembly Assembly { get { return assemblyb; } } [RequiresAssemblyFiles(UnknownStringMessageInRAF)] public override string Name { get { return name; } } public override string ScopeName { get { return name; } } public override Guid ModuleVersionId { get { return new Guid(guid); } } public override bool IsResource() { return false; } internal ModuleBuilder InternalModule => this; internal IntPtr GetUnderlyingNativeHandle() { return _impl; } [RequiresUnreferencedCode("Methods might be removed")] protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { if (global_type_created == null) return null; if (types == null) return global_type_created.GetMethod(name); return global_type_created.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveField(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveMember(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } internal MemberInfo ResolveOrGetRegisteredToken(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { ResolveTokenError error; MemberInfo? m = RuntimeModule.ResolveMemberToken(_impl, metadataToken, RuntimeModule.ptrs_from_types(genericTypeArguments), RuntimeModule.ptrs_from_types(genericMethodArguments), out error); if (m != null) return m; m = GetRegisteredToken(metadataToken) as MemberInfo; if (m == null) throw RuntimeModule.resolve_token_exception(this, metadataToken, error, "MemberInfo"); else return m; } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveMethod(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override string ResolveString(int metadataToken) { return RuntimeModule.ResolveString(this, _impl, metadataToken); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override byte[] ResolveSignature(int metadataToken) { return RuntimeModule.ResolveSignature(this, _impl, metadataToken); } [RequiresUnreferencedCode("Trimming changes metadata tokens")] public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { return RuntimeModule.ResolveType(this, _impl, metadataToken, genericTypeArguments, genericMethodArguments); } public override bool Equals(object? obj) { return base.Equals(obj); } public override int GetHashCode() { return base.GetHashCode(); } public override bool IsDefined(Type attributeType, bool inherit) { return base.IsDefined(attributeType, inherit); } public override object[] GetCustomAttributes(bool inherit) { return GetCustomAttributes(null!, inherit); // FIXME: coreclr doesn't allow null attributeType } public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (cattrs == null || cattrs.Length == 0) return Array.Empty<object>(); if (attributeType is TypeBuilder) throw new InvalidOperationException("First argument to GetCustomAttributes can't be a TypeBuilder"); List<object> results = new List<object>(); for (int i = 0; i < cattrs.Length; i++) { Type t = cattrs[i].Ctor.GetType(); if (t is TypeBuilder) throw new InvalidOperationException("Can't construct custom attribute for TypeBuilder type"); if (attributeType == null || attributeType.IsAssignableFrom(t)) results.Add(cattrs[i].Invoke()); } return results.ToArray(); } public override IList<CustomAttributeData> GetCustomAttributesData() { return CustomAttribute.GetCustomAttributesData(this); } [RequiresUnreferencedCode("Fields might be removed")] public override FieldInfo? GetField(string name, BindingFlags bindingAttr) { if (global_type_created == null) throw new InvalidOperationException("Module-level fields cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetField(name, bindingAttr); } [RequiresUnreferencedCode("Fields might be removed")] public override FieldInfo[] GetFields(BindingFlags bindingFlags) { if (global_type_created == null) throw new InvalidOperationException("Module-level fields cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetFields(bindingFlags); } [RequiresUnreferencedCode("Methods might be removed")] public override MethodInfo[] GetMethods(BindingFlags bindingFlags) { if (global_type_created == null) throw new InvalidOperationException("Module-level methods cannot be retrieved until after the CreateGlobalFunctions method has been called for the module."); return global_type_created.GetMethods(bindingFlags); } public override int MetadataToken { get { return RuntimeModule.get_MetadataToken(this); } } } internal sealed class ModuleBuilderTokenGenerator : ITokenGenerator { private ModuleBuilder mb; public ModuleBuilderTokenGenerator(ModuleBuilder mb) { this.mb = mb; } public int GetToken(string str) { return mb.GetToken(str); } public int GetToken(MemberInfo member, bool create_open_instance) { return mb.GetToken(member, create_open_instance); } public int GetToken(MethodBase method, Type[] opt_param_types) { return mb.GetToken(method, opt_param_types); } public int GetToken(SignatureHelper helper) { return mb.GetToken(helper); } } } #endif
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/mono/wasm/debugger/DebuggerTestSuite/appsettings.json
{ "Logging": { "LogLevel": { "Default": "Error", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", "DebuggerTests.TestHarnessProxy": "Debug", "Microsoft.WebAssembly.Diagnostics.DevToolsProxy": "Information", "Inspector": "Debug", "InspectorClient": "Debug", "DevToolsProxy": "Information", "DebuggerTests": "Debug" } } }
{ "Logging": { "LogLevel": { "Default": "Error", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", "DebuggerTests.TestHarnessProxy": "Debug", "Microsoft.WebAssembly.Diagnostics.DevToolsProxy": "Information", "Inspector": "Debug", "InspectorClient": "Debug", "DevToolsProxy": "Information", "DebuggerTests": "Debug" } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/OidCollection.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using Internal.Cryptography; namespace System.Security.Cryptography { public sealed class OidCollection : ICollection { private Oid[] _oids = Array.Empty<Oid>(); private int _count; public OidCollection() { } public int Add(Oid oid) { int count = _count; if (count == _oids.Length) { Array.Resize(ref _oids, count == 0 ? 4 : count * 2); } _oids[count] = oid; _count = count + 1; return count; } public Oid this[int index] { get { if ((uint)index >= (uint)_count) { // For compat, throw an ArgumentOutOfRangeException instead of // the IndexOutOfRangeException that comes from the array's indexer. throw new ArgumentOutOfRangeException(nameof(index)); } return _oids[index]; } } // Indexer using an OID friendly name or value. public Oid? this[string oid] { get { // If we were passed the friendly name, retrieve the value String. string? oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false); if (oidValue == null) { oidValue = oid; } for (int i = 0; i < _count; i++) { Oid entry = _oids[i]; if (entry.Value == oidValue) return entry; } return null; } } public int Count => _count; public OidEnumerator GetEnumerator() => new OidEnumerator(this); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); void ICollection.CopyTo(Array array, int index) { ArgumentNullException.ThrowIfNull(array); if (array.Rank != 1) throw new ArgumentException(SR.Arg_RankMultiDimNotSupported); if (index < 0 || index >= array.Length) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexMustBeLess); if (index + Count > array.Length) throw new ArgumentException(SR.Argument_InvalidOffLen); for (int i = 0; i < Count; i++) { array.SetValue(this[i], index); index++; } } public void CopyTo(Oid[] array, int index) { ArgumentNullException.ThrowIfNull(array); // Need to do part of the argument validation ourselves as OidCollection throws // ArgumentOutOfRangeException where List<>.CopyTo() throws ArgumentException. if (index < 0 || index >= array.Length) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexMustBeLess); Array.Copy(_oids, 0, array, index, _count); } public bool IsSynchronized => false; public object SyncRoot => this; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using Internal.Cryptography; namespace System.Security.Cryptography { public sealed class OidCollection : ICollection { private Oid[] _oids = Array.Empty<Oid>(); private int _count; public OidCollection() { } public int Add(Oid oid) { int count = _count; if (count == _oids.Length) { Array.Resize(ref _oids, count == 0 ? 4 : count * 2); } _oids[count] = oid; _count = count + 1; return count; } public Oid this[int index] { get { if ((uint)index >= (uint)_count) { // For compat, throw an ArgumentOutOfRangeException instead of // the IndexOutOfRangeException that comes from the array's indexer. throw new ArgumentOutOfRangeException(nameof(index)); } return _oids[index]; } } // Indexer using an OID friendly name or value. public Oid? this[string oid] { get { // If we were passed the friendly name, retrieve the value String. string? oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false); if (oidValue == null) { oidValue = oid; } for (int i = 0; i < _count; i++) { Oid entry = _oids[i]; if (entry.Value == oidValue) return entry; } return null; } } public int Count => _count; public OidEnumerator GetEnumerator() => new OidEnumerator(this); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); void ICollection.CopyTo(Array array, int index) { ArgumentNullException.ThrowIfNull(array); if (array.Rank != 1) throw new ArgumentException(SR.Arg_RankMultiDimNotSupported); if (index < 0 || index >= array.Length) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexMustBeLess); if (index + Count > array.Length) throw new ArgumentException(SR.Argument_InvalidOffLen); for (int i = 0; i < Count; i++) { array.SetValue(this[i], index); index++; } } public void CopyTo(Oid[] array, int index) { ArgumentNullException.ThrowIfNull(array); // Need to do part of the argument validation ourselves as OidCollection throws // ArgumentOutOfRangeException where List<>.CopyTo() throws ArgumentException. if (index < 0 || index >= array.Length) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexMustBeLess); Array.Copy(_oids, 0, array, index, _count); } public bool IsSynchronized => false; public object SyncRoot => this; } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Methodical/Methodical_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsMergedTestRunnerAssembly>true</IsMergedTestRunnerAssembly> </PropertyGroup> <ItemGroup> <ProjectReference Include="*/**/*_do.??proj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsMergedTestRunnerAssembly>true</IsMergedTestRunnerAssembly> </PropertyGroup> <ItemGroup> <ProjectReference Include="*/**/*_do.??proj" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/InterfaceFolding/Ambiguous.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Ambiguous.il" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Ambiguous.il" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Speech/src/Internal/SapiInterop/SpAudioStreamWrapper.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; using System.Speech.AudioFormat; using System.Speech.Internal.Synthesis; namespace System.Speech.Internal.SapiInterop { internal class SpAudioStreamWrapper : SpStreamWrapper, ISpStreamFormat { #region Constructors internal SpAudioStreamWrapper(Stream stream, SpeechAudioFormatInfo audioFormat) : base(stream) { // Assume PCM to start with _formatType = SAPIGuids.SPDFID_WaveFormatEx; if (audioFormat != null) { WAVEFORMATEX wfx = new(); wfx.wFormatTag = (short)audioFormat.EncodingFormat; wfx.nChannels = (short)audioFormat.ChannelCount; wfx.nSamplesPerSec = audioFormat.SamplesPerSecond; wfx.nAvgBytesPerSec = audioFormat.AverageBytesPerSecond; wfx.nBlockAlign = (short)audioFormat.BlockAlign; wfx.wBitsPerSample = (short)audioFormat.BitsPerSample; wfx.cbSize = (short)audioFormat.FormatSpecificData().Length; _wfx = wfx.ToBytes(); if (wfx.cbSize == 0) { byte[] wfxTemp = new byte[_wfx.Length + wfx.cbSize]; Array.Copy(_wfx, wfxTemp, _wfx.Length); Array.Copy(audioFormat.FormatSpecificData(), 0, wfxTemp, _wfx.Length, wfx.cbSize); _wfx = wfxTemp; } } else { try { GetStreamOffsets(stream); } catch (IOException) { throw new FormatException(SR.Get(SRID.SynthesizerInvalidWaveFile)); } } } #endregion #region public Methods #region ISpStreamFormat interface implementation void ISpStreamFormat.GetFormat(out Guid guid, out IntPtr format) { guid = _formatType; format = Marshal.AllocCoTaskMem(_wfx.Length); Marshal.Copy(_wfx, 0, format, _wfx.Length); } #endregion #endregion #region Internal Methods #pragma warning disable 56518 // The Binary reader cannot be disposed or it would close the underlying stream /// <summary> /// Builds the /// </summary> internal void GetStreamOffsets(Stream stream) { BinaryReader br = new(stream); // Read the riff Header RIFFHDR riff = new(); riff._id = br.ReadUInt32(); riff._len = br.ReadInt32(); riff._type = br.ReadUInt32(); if (riff._id != RIFF_MARKER && riff._type != WAVE_MARKER) { throw new FormatException(); } BLOCKHDR block = new(); block._id = br.ReadUInt32(); block._len = br.ReadInt32(); if (block._id != FMT_MARKER) { throw new FormatException(); } // If the format is of type WAVEFORMAT then fake a cbByte with a length of zero _wfx = br.ReadBytes(block._len); // Hardcode the value of the size for the structure element // as the C# compiler pads the structure to the closest 4 or 8 bytes if (block._len == 16) { byte[] wfxTemp = new byte[18]; Array.Copy(_wfx, wfxTemp, 16); _wfx = wfxTemp; } while (true) { DATAHDR dataHdr = new(); // check for the end of file (+8 for the 2 DWORD) if (stream.Position + 8 >= stream.Length) { break; } dataHdr._id = br.ReadUInt32(); dataHdr._len = br.ReadInt32(); // Is this the WAVE data? if (dataHdr._id == DATA_MARKER) { _endOfStreamPosition = stream.Position + dataHdr._len; break; } else { // Skip this RIFF fragment. stream.Seek(dataHdr._len, SeekOrigin.Current); } } } #pragma warning restore 56518 // The Binary reader cannot be disposed or it would close the underlying stream #endregion #region Private Types private const uint RIFF_MARKER = 0x46464952; private const uint WAVE_MARKER = 0x45564157; private const uint FMT_MARKER = 0x20746d66; private const uint DATA_MARKER = 0x61746164; [StructLayout(LayoutKind.Sequential)] private struct RIFFHDR { internal uint _id; internal int _len; /* file length less header */ internal uint _type; /* should be "WAVE" */ } [StructLayout(LayoutKind.Sequential)] private struct BLOCKHDR { internal uint _id; /* should be "fmt " or "data" */ internal int _len; /* block size less header */ }; [StructLayout(LayoutKind.Sequential)] private struct DATAHDR { internal uint _id; /* should be "fmt " or "data" */ internal int _len; /* block size less header */ } #endregion #region Private Fields private byte[] _wfx; private Guid _formatType; #endregion } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; using System.Speech.AudioFormat; using System.Speech.Internal.Synthesis; namespace System.Speech.Internal.SapiInterop { internal class SpAudioStreamWrapper : SpStreamWrapper, ISpStreamFormat { #region Constructors internal SpAudioStreamWrapper(Stream stream, SpeechAudioFormatInfo audioFormat) : base(stream) { // Assume PCM to start with _formatType = SAPIGuids.SPDFID_WaveFormatEx; if (audioFormat != null) { WAVEFORMATEX wfx = new(); wfx.wFormatTag = (short)audioFormat.EncodingFormat; wfx.nChannels = (short)audioFormat.ChannelCount; wfx.nSamplesPerSec = audioFormat.SamplesPerSecond; wfx.nAvgBytesPerSec = audioFormat.AverageBytesPerSecond; wfx.nBlockAlign = (short)audioFormat.BlockAlign; wfx.wBitsPerSample = (short)audioFormat.BitsPerSample; wfx.cbSize = (short)audioFormat.FormatSpecificData().Length; _wfx = wfx.ToBytes(); if (wfx.cbSize == 0) { byte[] wfxTemp = new byte[_wfx.Length + wfx.cbSize]; Array.Copy(_wfx, wfxTemp, _wfx.Length); Array.Copy(audioFormat.FormatSpecificData(), 0, wfxTemp, _wfx.Length, wfx.cbSize); _wfx = wfxTemp; } } else { try { GetStreamOffsets(stream); } catch (IOException) { throw new FormatException(SR.Get(SRID.SynthesizerInvalidWaveFile)); } } } #endregion #region public Methods #region ISpStreamFormat interface implementation void ISpStreamFormat.GetFormat(out Guid guid, out IntPtr format) { guid = _formatType; format = Marshal.AllocCoTaskMem(_wfx.Length); Marshal.Copy(_wfx, 0, format, _wfx.Length); } #endregion #endregion #region Internal Methods #pragma warning disable 56518 // The Binary reader cannot be disposed or it would close the underlying stream /// <summary> /// Builds the /// </summary> internal void GetStreamOffsets(Stream stream) { BinaryReader br = new(stream); // Read the riff Header RIFFHDR riff = new(); riff._id = br.ReadUInt32(); riff._len = br.ReadInt32(); riff._type = br.ReadUInt32(); if (riff._id != RIFF_MARKER && riff._type != WAVE_MARKER) { throw new FormatException(); } BLOCKHDR block = new(); block._id = br.ReadUInt32(); block._len = br.ReadInt32(); if (block._id != FMT_MARKER) { throw new FormatException(); } // If the format is of type WAVEFORMAT then fake a cbByte with a length of zero _wfx = br.ReadBytes(block._len); // Hardcode the value of the size for the structure element // as the C# compiler pads the structure to the closest 4 or 8 bytes if (block._len == 16) { byte[] wfxTemp = new byte[18]; Array.Copy(_wfx, wfxTemp, 16); _wfx = wfxTemp; } while (true) { DATAHDR dataHdr = new(); // check for the end of file (+8 for the 2 DWORD) if (stream.Position + 8 >= stream.Length) { break; } dataHdr._id = br.ReadUInt32(); dataHdr._len = br.ReadInt32(); // Is this the WAVE data? if (dataHdr._id == DATA_MARKER) { _endOfStreamPosition = stream.Position + dataHdr._len; break; } else { // Skip this RIFF fragment. stream.Seek(dataHdr._len, SeekOrigin.Current); } } } #pragma warning restore 56518 // The Binary reader cannot be disposed or it would close the underlying stream #endregion #region Private Types private const uint RIFF_MARKER = 0x46464952; private const uint WAVE_MARKER = 0x45564157; private const uint FMT_MARKER = 0x20746d66; private const uint DATA_MARKER = 0x61746164; [StructLayout(LayoutKind.Sequential)] private struct RIFFHDR { internal uint _id; internal int _len; /* file length less header */ internal uint _type; /* should be "WAVE" */ } [StructLayout(LayoutKind.Sequential)] private struct BLOCKHDR { internal uint _id; /* should be "fmt " or "data" */ internal int _len; /* block size less header */ }; [StructLayout(LayoutKind.Sequential)] private struct DATAHDR { internal uint _id; /* should be "fmt " or "data" */ internal int _len; /* block size less header */ } #endregion #region Private Fields private byte[] _wfx; private Guid _formatType; #endregion } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType/System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <RootNamespace>System.Runtime.Loader.Tests</RootNamespace> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <TestRuntime>true</TestRuntime> <DeltaScript>deltascript.json</DeltaScript> </PropertyGroup> <ItemGroup> <Compile Include="ReflectionAddNewType.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <RootNamespace>System.Runtime.Loader.Tests</RootNamespace> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <TestRuntime>true</TestRuntime> <DeltaScript>deltascript.json</DeltaScript> </PropertyGroup> <ItemGroup> <Compile Include="ReflectionAddNewType.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/Common/src/System/Net/ContextFlagsAdapterPal.PlatformNotSupported.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Runtime.Versioning; namespace System.Net { [UnsupportedOSPlatform("tvos")] internal static class ContextFlagsAdapterPal { internal static ContextFlagsPal GetContextFlagsPalFromInterop(Interop.NetSecurityNative.GssFlags gssFlags, bool isServer) { throw new PlatformNotSupportedException(); } internal static Interop.NetSecurityNative.GssFlags GetInteropFromContextFlagsPal(ContextFlagsPal flags, bool isServer) { throw new PlatformNotSupportedException(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Runtime.Versioning; namespace System.Net { [UnsupportedOSPlatform("tvos")] internal static class ContextFlagsAdapterPal { internal static ContextFlagsPal GetContextFlagsPalFromInterop(Interop.NetSecurityNative.GssFlags gssFlags, bool isServer) { throw new PlatformNotSupportedException(); } internal static Interop.NetSecurityNative.GssFlags GetInteropFromContextFlagsPal(ContextFlagsPal flags, bool isServer) { throw new PlatformNotSupportedException(); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/mono/mono/utils/mono-compiler.h
/** * \file */ #ifndef __UTILS_MONO_COMPILER_H__ #define __UTILS_MONO_COMPILER_H__ /* * This file includes macros used in the runtime to encapsulate different * compiler behaviours. */ #include <config.h> #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif #include <mono/utils/mono-publib.h> #ifdef __GNUC__ #define MONO_ATTR_USED __attribute__ ((__used__)) #else #define MONO_ATTR_USED #endif #ifdef __GNUC__ #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) __attribute__ ((__format__(__printf__,fmt_pos,arg_pos))) #else #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) #endif /* Deal with Microsoft C compiler differences */ #ifdef _MSC_VER #include <math.h> #include <float.h> #define popen _popen #define pclose _pclose #include <direct.h> #define mkdir(x) _mkdir(x) #define __func__ __FUNCTION__ #include <stddef.h> #include <stdint.h> // ssize_t and SSIZE_MAX are Posix, define for Windows. typedef ptrdiff_t ssize_t; #ifndef SSIZE_MAX #define SSIZE_MAX INTPTR_MAX #endif #endif /* _MSC_VER */ // Quiet Visual Studio linker warning, LNK4221: This object file does not define any previously // undefined public symbols, so it will not be used by any link operation that consumes this library. // And other linkers, e.g. older Apple. #define MONO_EMPTY_SOURCE_FILE(x) extern const char mono_quash_linker_empty_file_warning_ ## x; \ const char mono_quash_linker_empty_file_warning_ ## x = 0; #ifdef _MSC_VER #define MONO_PRAGMA_WARNING_PUSH() __pragma(warning (push)) #define MONO_PRAGMA_WARNING_DISABLE(x) __pragma(warning (disable:x)) #define MONO_PRAGMA_WARNING_POP() __pragma(warning (pop)) #define MONO_DISABLE_WARNING(x) \ MONO_PRAGMA_WARNING_PUSH() \ MONO_PRAGMA_WARNING_DISABLE(x) #define MONO_RESTORE_WARNING \ MONO_PRAGMA_WARNING_POP() #else #define MONO_PRAGMA_WARNING_PUSH() #define MONO_PRAGMA_WARNING_DISABLE(x) #define MONO_PRAGMA_WARNING_POP() #define MONO_DISABLE_WARNING(x) #define MONO_RESTORE_WARNING #endif /* Used to mark internal functions used by the profiler modules */ #define MONO_PROFILER_API MONO_API /* Used to mark internal functions used by the CoreFX PAL library */ #define MONO_PAL_API MONO_API /* Mono components */ /* Used to mark internal functions used by dynamically linked runtime components */ #define MONO_COMPONENT_API MONO_API #ifdef COMPILING_COMPONENT_DYNAMIC #define MONO_COMPONENT_EXPORT_ENTRYPOINT MONO_EXTERN_C MONO_API_EXPORT #else #define MONO_COMPONENT_EXPORT_ENTRYPOINT /* empty */ #endif #ifdef __GNUC__ #define MONO_ALWAYS_INLINE __attribute__ ((__always_inline__)) #elif defined(_MSC_VER) #define MONO_ALWAYS_INLINE __forceinline #else #define MONO_ALWAYS_INLINE #endif #ifdef __GNUC__ #define MONO_NEVER_INLINE __attribute__ ((__noinline__)) #elif defined(_MSC_VER) #define MONO_NEVER_INLINE __declspec(noinline) #else #define MONO_NEVER_INLINE #endif #ifdef __GNUC__ #define MONO_COLD __attribute__ ((__cold__)) #else #define MONO_COLD #endif #if defined (__clang__) #define MONO_NO_OPTIMIZATION __attribute__ ((optnone)) #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) #define MONO_NO_OPTIMIZATION __attribute__ ((optimize("O0"))) #else #define MONO_NO_OPTIMIZATION /* nothing */ #endif #if defined (__GNUC__) && defined (__GNUC_MINOR__) && defined (__GNUC_PATCHLEVEL__) #define MONO_GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif #if defined(__has_feature) #if __has_feature(thread_sanitizer) #define MONO_HAS_CLANG_THREAD_SANITIZER 1 #else #define MONO_HAS_CLANG_THREAD_SANITIZER 0 #endif #if __has_feature(address_sanitizer) #define MONO_HAS_CLANG_ADDRESS_SANITIZER 1 #else #define MONO_HAS_CLANG_ADDRESS_SANITIZER 0 #endif #else #define MONO_HAS_CLANG_THREAD_SANITIZER 0 #define MONO_HAS_CLANG_ADDRESS_SANITIZER 0 #endif /* Used to tell Clang's ThreadSanitizer to not report data races that occur within a certain function */ #if MONO_HAS_CLANG_THREAD_SANITIZER #define MONO_NO_SANITIZE_THREAD __attribute__ ((no_sanitize("thread"))) #else #define MONO_NO_SANITIZE_THREAD #endif /* Used to tell Clang's AddressSanitizer to turn off instrumentation for a certain function */ #if MONO_HAS_CLANG_ADDRESS_SANITIZER #define MONO_NO_SANITIZE_ADDRESS __attribute__ ((no_sanitize("address"))) #else #define MONO_NO_SANITIZE_ADDRESS #endif #endif /* __UTILS_MONO_COMPILER_H__*/
/** * \file */ #ifndef __UTILS_MONO_COMPILER_H__ #define __UTILS_MONO_COMPILER_H__ /* * This file includes macros used in the runtime to encapsulate different * compiler behaviours. */ #include <config.h> #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif #include <mono/utils/mono-publib.h> #ifdef __GNUC__ #define MONO_ATTR_USED __attribute__ ((__used__)) #else #define MONO_ATTR_USED #endif #ifdef __GNUC__ #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) __attribute__ ((__format__(__printf__,fmt_pos,arg_pos))) #else #define MONO_ATTR_FORMAT_PRINTF(fmt_pos,arg_pos) #endif /* Deal with Microsoft C compiler differences */ #ifdef _MSC_VER #include <math.h> #include <float.h> #define popen _popen #define pclose _pclose #include <direct.h> #define mkdir(x) _mkdir(x) #define __func__ __FUNCTION__ #include <stddef.h> #include <stdint.h> // ssize_t and SSIZE_MAX are Posix, define for Windows. typedef ptrdiff_t ssize_t; #ifndef SSIZE_MAX #define SSIZE_MAX INTPTR_MAX #endif #endif /* _MSC_VER */ // Quiet Visual Studio linker warning, LNK4221: This object file does not define any previously // undefined public symbols, so it will not be used by any link operation that consumes this library. // And other linkers, e.g. older Apple. #define MONO_EMPTY_SOURCE_FILE(x) extern const char mono_quash_linker_empty_file_warning_ ## x; \ const char mono_quash_linker_empty_file_warning_ ## x = 0; #ifdef _MSC_VER #define MONO_PRAGMA_WARNING_PUSH() __pragma(warning (push)) #define MONO_PRAGMA_WARNING_DISABLE(x) __pragma(warning (disable:x)) #define MONO_PRAGMA_WARNING_POP() __pragma(warning (pop)) #define MONO_DISABLE_WARNING(x) \ MONO_PRAGMA_WARNING_PUSH() \ MONO_PRAGMA_WARNING_DISABLE(x) #define MONO_RESTORE_WARNING \ MONO_PRAGMA_WARNING_POP() #else #define MONO_PRAGMA_WARNING_PUSH() #define MONO_PRAGMA_WARNING_DISABLE(x) #define MONO_PRAGMA_WARNING_POP() #define MONO_DISABLE_WARNING(x) #define MONO_RESTORE_WARNING #endif /* Used to mark internal functions used by the profiler modules */ #define MONO_PROFILER_API MONO_API /* Used to mark internal functions used by the CoreFX PAL library */ #define MONO_PAL_API MONO_API /* Mono components */ /* Used to mark internal functions used by dynamically linked runtime components */ #define MONO_COMPONENT_API MONO_API #ifdef COMPILING_COMPONENT_DYNAMIC #define MONO_COMPONENT_EXPORT_ENTRYPOINT MONO_EXTERN_C MONO_API_EXPORT #else #define MONO_COMPONENT_EXPORT_ENTRYPOINT /* empty */ #endif #ifdef __GNUC__ #define MONO_ALWAYS_INLINE __attribute__ ((__always_inline__)) #elif defined(_MSC_VER) #define MONO_ALWAYS_INLINE __forceinline #else #define MONO_ALWAYS_INLINE #endif #ifdef __GNUC__ #define MONO_NEVER_INLINE __attribute__ ((__noinline__)) #elif defined(_MSC_VER) #define MONO_NEVER_INLINE __declspec(noinline) #else #define MONO_NEVER_INLINE #endif #ifdef __GNUC__ #define MONO_COLD __attribute__ ((__cold__)) #else #define MONO_COLD #endif #if defined (__clang__) #define MONO_NO_OPTIMIZATION __attribute__ ((optnone)) #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) #define MONO_NO_OPTIMIZATION __attribute__ ((optimize("O0"))) #else #define MONO_NO_OPTIMIZATION /* nothing */ #endif #if defined (__GNUC__) && defined (__GNUC_MINOR__) && defined (__GNUC_PATCHLEVEL__) #define MONO_GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif #if defined(__has_feature) #if __has_feature(thread_sanitizer) #define MONO_HAS_CLANG_THREAD_SANITIZER 1 #else #define MONO_HAS_CLANG_THREAD_SANITIZER 0 #endif #if __has_feature(address_sanitizer) #define MONO_HAS_CLANG_ADDRESS_SANITIZER 1 #else #define MONO_HAS_CLANG_ADDRESS_SANITIZER 0 #endif #else #define MONO_HAS_CLANG_THREAD_SANITIZER 0 #define MONO_HAS_CLANG_ADDRESS_SANITIZER 0 #endif /* Used to tell Clang's ThreadSanitizer to not report data races that occur within a certain function */ #if MONO_HAS_CLANG_THREAD_SANITIZER #define MONO_NO_SANITIZE_THREAD __attribute__ ((no_sanitize("thread"))) #else #define MONO_NO_SANITIZE_THREAD #endif /* Used to tell Clang's AddressSanitizer to turn off instrumentation for a certain function */ #if MONO_HAS_CLANG_ADDRESS_SANITIZER #define MONO_NO_SANITIZE_ADDRESS __attribute__ ((no_sanitize("address"))) #else #define MONO_NO_SANITIZE_ADDRESS #endif #endif /* __UTILS_MONO_COMPILER_H__*/
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest1468/Generated1468.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated1468.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated1468.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Private.Xml/tests/Xslt/TestFiles/TestData/XsltApiV2/showParam.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:param name="myArg1" select="'No Value Specified'"/> <xsl:param name="myArg2" select="'No Value Specified'"/> <xsl:param name="myArg3" select="'No Value Specified'"/> <xsl:param name="myArg4" select="'No Value Specified'"/> <xsl:param name="myArg5" select="'No Value Specified'"/> <xsl:param name="myArg6" select="'No Value Specified'"/> <xsl:template match="/"> <result> <arg1><xsl:value-of select="$myArg1" /></arg1> <arg2><xsl:value-of select="$myArg2" /></arg2> <arg3><xsl:value-of select="$myArg3" /></arg3> <arg4><xsl:value-of select="$myArg4" /></arg4> <arg5><xsl:value-of select="$myArg5" /></arg5> <arg6><xsl:value-of select="$myArg6" /></arg6> </result> </xsl:template> </xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:param name="myArg1" select="'No Value Specified'"/> <xsl:param name="myArg2" select="'No Value Specified'"/> <xsl:param name="myArg3" select="'No Value Specified'"/> <xsl:param name="myArg4" select="'No Value Specified'"/> <xsl:param name="myArg5" select="'No Value Specified'"/> <xsl:param name="myArg6" select="'No Value Specified'"/> <xsl:template match="/"> <result> <arg1><xsl:value-of select="$myArg1" /></arg1> <arg2><xsl:value-of select="$myArg2" /></arg2> <arg3><xsl:value-of select="$myArg3" /></arg3> <arg4><xsl:value-of select="$myArg4" /></arg4> <arg5><xsl:value-of select="$myArg5" /></arg5> <arg6><xsl:value-of select="$myArg6" /></arg6> </result> </xsl:template> </xsl:stylesheet>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.AddBefore.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using Xunit; namespace System.Collections.Tests { /// <summary> /// Contains tests that ensure the correctness of the LinkedList class. /// </summary> public abstract partial class LinkedList_Generic_Tests<T> : ICollection_Generic_Tests<T> { [Fact] public void AddBefore_LLNode() { LinkedList<T> linkedList = new LinkedList<T>(); int arraySize = 16; int seed = 8293; T[] tempItems, headItems, headItemsReverse, tailItems, tailItemsReverse; headItems = new T[arraySize]; tailItems = new T[arraySize]; headItemsReverse = new T[arraySize]; tailItemsReverse = new T[arraySize]; for (int i = 0; i < arraySize; i++) { int index = (arraySize - 1) - i; T head = CreateT(seed++); T tail = CreateT(seed++); headItems[i] = head; headItemsReverse[index] = head; tailItems[i] = tail; tailItemsReverse[index] = tail; } //[] Verify value is default(T) linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddBefore(linkedList.First, default(T)); InitialItems_Tests(linkedList, new T[] { default(T), headItems[0] }); //[] Node is the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); InitialItems_Tests(linkedList, headItemsReverse); //[] Node is the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 1, tempItems, 0, headItems.Length - 1); tempItems[tempItems.Length - 1] = headItems[0]; for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is after the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, tempItems, headItems.Length); Array.Reverse(tempItems, 1, headItems.Length - 1); for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.First.Next, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is before the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 2, tempItems, 0, headItems.Length - 2); tempItems[tempItems.Length - 2] = headItems[0]; tempItems[tempItems.Length - 1] = headItems[1]; for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is somewhere in the middle linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); linkedList.AddLast(headItems[2]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 3, tempItems, 0, headItems.Length - 3); tempItems[tempItems.Length - 3] = headItems[0]; tempItems[tempItems.Length - 2] = headItems[1]; tempItems[tempItems.Length - 1] = headItems[2]; for (int i = 3; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous.Previous, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Call AddBefore several times remove some of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.Remove(headItems[2]); linkedList.Remove(headItems[headItems.Length - 3]); linkedList.Remove(headItems[1]); linkedList.Remove(headItems[headItems.Length - 2]); linkedList.RemoveFirst(); linkedList.RemoveLast(); //With the above remove we should have removed the first and last 3 items tempItems = new T[headItemsReverse.Length - 6]; Array.Copy(headItemsReverse, 3, tempItems, 0, headItemsReverse.Length - 6); InitialItems_Tests(linkedList, tempItems); for (int i = 0; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); T[] tempItems2 = new T[tailItemsReverse.Length + tempItems.Length]; Array.Copy(tailItemsReverse, tempItems2, tailItemsReverse.Length); Array.Copy(tempItems, 0, tempItems2, tailItemsReverse.Length, tempItems.Length); InitialItems_Tests(linkedList, tempItems2); //[] Call AddBefore several times remove all of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); for (int i = 0; i < arraySize; ++i) linkedList.RemoveFirst(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); InitialItems_Tests(linkedList, tailItemsReverse); //[] Call AddBefore several times then call Clear linkedList.Clear(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.Clear(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); InitialItems_Tests(linkedList, tailItemsReverse); //[] Mix AddBefore and AddAfter calls linkedList = new LinkedList<T>(); linkedList.AddLast(headItems[0]); linkedList.AddLast(tailItems[0]); for (int i = 1; i < arraySize; ++i) { linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.AddAfter(linkedList.Last, tailItems[i]); } tempItems = new T[headItemsReverse.Length + tailItems.Length]; Array.Copy(headItemsReverse, tempItems, headItemsReverse.Length); Array.Copy(tailItems, 0, tempItems, headItemsReverse.Length, tailItems.Length); InitialItems_Tests(linkedList, tempItems); } [Fact] public void AddBefore_LLNode_Negative() { LinkedList<T> linkedList = new LinkedList<T>(); LinkedList<T> tempLinkedList = new LinkedList<T>(); int seed = 8293; T[] items; //[] Verify Null node Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(null, CreateT(seed++))); //"Err_858ahia Expected null node to throws ArgumentNullException\n" InitialItems_Tests(linkedList, new T[0]); //[] Verify Node that is a new Node linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(new LinkedListNode<T>(CreateT(seed++)), CreateT(seed++))); //"Err_0568ajods Expected Node that is a new Node throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify Node that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(tempLinkedList.Last, CreateT(seed++))); //"Err_98809ahied Node that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); } [Fact] public void AddBefore_LLNode_LLNode() { LinkedList<T> linkedList = new LinkedList<T>(); int arraySize = 16; int seed = 8293; T[] tempItems, headItems, headItemsReverse, tailItems, tailItemsReverse; headItems = new T[arraySize]; tailItems = new T[arraySize]; headItemsReverse = new T[arraySize]; tailItemsReverse = new T[arraySize]; for (int i = 0; i < arraySize; i++) { int index = (arraySize - 1) - i; T head = CreateT(seed++); T tail = CreateT(seed++); headItems[i] = head; headItemsReverse[index] = head; tailItems[i] = tail; tailItemsReverse[index] = tail; } //[] Verify value is default(T) linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(default(T))); InitialItems_Tests(linkedList, new T[] { default(T), headItems[0] }); //[] Node is the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, headItemsReverse); //[] Node is the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 1, tempItems, 0, headItems.Length - 1); tempItems[tempItems.Length - 1] = headItems[0]; for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is after the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, tempItems, headItems.Length); Array.Reverse(tempItems, 1, headItems.Length - 1); for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.First.Next, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is before the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 2, tempItems, 0, headItems.Length - 2); tempItems[tempItems.Length - 2] = headItems[0]; tempItems[tempItems.Length - 1] = headItems[1]; for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is somewhere in the middle linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); linkedList.AddLast(headItems[2]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 3, tempItems, 0, headItems.Length - 3); tempItems[tempItems.Length - 3] = headItems[0]; tempItems[tempItems.Length - 2] = headItems[1]; tempItems[tempItems.Length - 1] = headItems[2]; for (int i = 3; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous.Previous, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Call AddBefore several times remove some of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.Remove(headItems[2]); linkedList.Remove(headItems[headItems.Length - 3]); linkedList.Remove(headItems[1]); linkedList.Remove(headItems[headItems.Length - 2]); linkedList.RemoveFirst(); linkedList.RemoveLast(); //With the above remove we should have removed the first and last 3 items tempItems = new T[headItemsReverse.Length - 6]; Array.Copy(headItemsReverse, 3, tempItems, 0, headItemsReverse.Length - 6); InitialItems_Tests(linkedList, tempItems); for (int i = 0; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); T[] tempItems2 = new T[tailItemsReverse.Length + tempItems.Length]; Array.Copy(tailItemsReverse, tempItems2, tailItemsReverse.Length); Array.Copy(tempItems, 0, tempItems2, tailItemsReverse.Length, tempItems.Length); InitialItems_Tests(linkedList, tempItems2); //[] Call AddBefore several times remove all of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); for (int i = 0; i < arraySize; ++i) linkedList.RemoveFirst(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); InitialItems_Tests(linkedList, tailItemsReverse); //[] Call AddBefore several times then call Clear linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.Clear(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); InitialItems_Tests(linkedList, tailItemsReverse); //[] Mix AddBefore and AddAfter calls linkedList = new LinkedList<T>(); linkedList.AddLast(headItems[0]); linkedList.AddLast(tailItems[0]); for (int i = 1; i < arraySize; ++i) { linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.AddAfter(linkedList.Last, new LinkedListNode<T>(tailItems[i])); } tempItems = new T[headItemsReverse.Length + tailItems.Length]; Array.Copy(headItemsReverse, tempItems, headItemsReverse.Length); Array.Copy(tailItems, 0, tempItems, headItemsReverse.Length, tailItems.Length); InitialItems_Tests(linkedList, tempItems); } [Fact] public void AddBefore_LLNode_LLNode_Negative() { LinkedList<T> linkedList = new LinkedList<T>(); LinkedList<T> tempLinkedList = new LinkedList<T>(); int seed = 8293; T[] items; //[] Verify Null node Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(null, new LinkedListNode<T>(CreateT(seed++)))); //"Err_858ahia Expected null node to throws ArgumentNullException\n" InitialItems_Tests(linkedList, new T[0]); //[] Verify Node that is a new Node linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(new LinkedListNode<T>(CreateT(seed++)), new LinkedListNode<T>(CreateT(seed++)))); //"Err_0568ajods Expected Node that is a new Node throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify Node that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(tempLinkedList.Last, new LinkedListNode<T>(CreateT(seed++)))); //"Err_98809ahied Node that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); // Tests for the NewNode //[] Verify Null newNode linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(linkedList.First, null)); //"Err_0808ajeoia Expected null newNode to throws ArgumentNullException\n" InitialItems_Tests(linkedList, items); //[] Verify newNode that already exists in this collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(linkedList.First, linkedList.Last)); //"Err_58808adjioe Verify newNode that already exists in this collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify newNode that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(linkedList.First, tempLinkedList.Last)); //"Err_54808ajied newNode that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using Xunit; namespace System.Collections.Tests { /// <summary> /// Contains tests that ensure the correctness of the LinkedList class. /// </summary> public abstract partial class LinkedList_Generic_Tests<T> : ICollection_Generic_Tests<T> { [Fact] public void AddBefore_LLNode() { LinkedList<T> linkedList = new LinkedList<T>(); int arraySize = 16; int seed = 8293; T[] tempItems, headItems, headItemsReverse, tailItems, tailItemsReverse; headItems = new T[arraySize]; tailItems = new T[arraySize]; headItemsReverse = new T[arraySize]; tailItemsReverse = new T[arraySize]; for (int i = 0; i < arraySize; i++) { int index = (arraySize - 1) - i; T head = CreateT(seed++); T tail = CreateT(seed++); headItems[i] = head; headItemsReverse[index] = head; tailItems[i] = tail; tailItemsReverse[index] = tail; } //[] Verify value is default(T) linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddBefore(linkedList.First, default(T)); InitialItems_Tests(linkedList, new T[] { default(T), headItems[0] }); //[] Node is the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); InitialItems_Tests(linkedList, headItemsReverse); //[] Node is the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 1, tempItems, 0, headItems.Length - 1); tempItems[tempItems.Length - 1] = headItems[0]; for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is after the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, tempItems, headItems.Length); Array.Reverse(tempItems, 1, headItems.Length - 1); for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.First.Next, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is before the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 2, tempItems, 0, headItems.Length - 2); tempItems[tempItems.Length - 2] = headItems[0]; tempItems[tempItems.Length - 1] = headItems[1]; for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Node is somewhere in the middle linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); linkedList.AddLast(headItems[2]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 3, tempItems, 0, headItems.Length - 3); tempItems[tempItems.Length - 3] = headItems[0]; tempItems[tempItems.Length - 2] = headItems[1]; tempItems[tempItems.Length - 1] = headItems[2]; for (int i = 3; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous.Previous, headItems[i]); InitialItems_Tests(linkedList, tempItems); //[] Call AddBefore several times remove some of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.Remove(headItems[2]); linkedList.Remove(headItems[headItems.Length - 3]); linkedList.Remove(headItems[1]); linkedList.Remove(headItems[headItems.Length - 2]); linkedList.RemoveFirst(); linkedList.RemoveLast(); //With the above remove we should have removed the first and last 3 items tempItems = new T[headItemsReverse.Length - 6]; Array.Copy(headItemsReverse, 3, tempItems, 0, headItemsReverse.Length - 6); InitialItems_Tests(linkedList, tempItems); for (int i = 0; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); T[] tempItems2 = new T[tailItemsReverse.Length + tempItems.Length]; Array.Copy(tailItemsReverse, tempItems2, tailItemsReverse.Length); Array.Copy(tempItems, 0, tempItems2, tailItemsReverse.Length, tempItems.Length); InitialItems_Tests(linkedList, tempItems2); //[] Call AddBefore several times remove all of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); for (int i = 0; i < arraySize; ++i) linkedList.RemoveFirst(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); InitialItems_Tests(linkedList, tailItemsReverse); //[] Call AddBefore several times then call Clear linkedList.Clear(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.Clear(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, tailItems[i]); InitialItems_Tests(linkedList, tailItemsReverse); //[] Mix AddBefore and AddAfter calls linkedList = new LinkedList<T>(); linkedList.AddLast(headItems[0]); linkedList.AddLast(tailItems[0]); for (int i = 1; i < arraySize; ++i) { linkedList.AddBefore(linkedList.First, headItems[i]); linkedList.AddAfter(linkedList.Last, tailItems[i]); } tempItems = new T[headItemsReverse.Length + tailItems.Length]; Array.Copy(headItemsReverse, tempItems, headItemsReverse.Length); Array.Copy(tailItems, 0, tempItems, headItemsReverse.Length, tailItems.Length); InitialItems_Tests(linkedList, tempItems); } [Fact] public void AddBefore_LLNode_Negative() { LinkedList<T> linkedList = new LinkedList<T>(); LinkedList<T> tempLinkedList = new LinkedList<T>(); int seed = 8293; T[] items; //[] Verify Null node Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(null, CreateT(seed++))); //"Err_858ahia Expected null node to throws ArgumentNullException\n" InitialItems_Tests(linkedList, new T[0]); //[] Verify Node that is a new Node linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(new LinkedListNode<T>(CreateT(seed++)), CreateT(seed++))); //"Err_0568ajods Expected Node that is a new Node throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify Node that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(tempLinkedList.Last, CreateT(seed++))); //"Err_98809ahied Node that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); } [Fact] public void AddBefore_LLNode_LLNode() { LinkedList<T> linkedList = new LinkedList<T>(); int arraySize = 16; int seed = 8293; T[] tempItems, headItems, headItemsReverse, tailItems, tailItemsReverse; headItems = new T[arraySize]; tailItems = new T[arraySize]; headItemsReverse = new T[arraySize]; tailItemsReverse = new T[arraySize]; for (int i = 0; i < arraySize; i++) { int index = (arraySize - 1) - i; T head = CreateT(seed++); T tail = CreateT(seed++); headItems[i] = head; headItemsReverse[index] = head; tailItems[i] = tail; tailItemsReverse[index] = tail; } //[] Verify value is default(T) linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(default(T))); InitialItems_Tests(linkedList, new T[] { default(T), headItems[0] }); //[] Node is the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, headItemsReverse); //[] Node is the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 1, tempItems, 0, headItems.Length - 1); tempItems[tempItems.Length - 1] = headItems[0]; for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is after the Head linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, tempItems, headItems.Length); Array.Reverse(tempItems, 1, headItems.Length - 1); for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.First.Next, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is before the Tail linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 2, tempItems, 0, headItems.Length - 2); tempItems[tempItems.Length - 2] = headItems[0]; tempItems[tempItems.Length - 1] = headItems[1]; for (int i = 2; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Node is somewhere in the middle linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); linkedList.AddLast(headItems[1]); linkedList.AddLast(headItems[2]); tempItems = new T[headItems.Length]; Array.Copy(headItems, 3, tempItems, 0, headItems.Length - 3); tempItems[tempItems.Length - 3] = headItems[0]; tempItems[tempItems.Length - 2] = headItems[1]; tempItems[tempItems.Length - 1] = headItems[2]; for (int i = 3; i < arraySize; ++i) linkedList.AddBefore(linkedList.Last.Previous.Previous, new LinkedListNode<T>(headItems[i])); InitialItems_Tests(linkedList, tempItems); //[] Call AddBefore several times remove some of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.Remove(headItems[2]); linkedList.Remove(headItems[headItems.Length - 3]); linkedList.Remove(headItems[1]); linkedList.Remove(headItems[headItems.Length - 2]); linkedList.RemoveFirst(); linkedList.RemoveLast(); //With the above remove we should have removed the first and last 3 items tempItems = new T[headItemsReverse.Length - 6]; Array.Copy(headItemsReverse, 3, tempItems, 0, headItemsReverse.Length - 6); InitialItems_Tests(linkedList, tempItems); for (int i = 0; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); T[] tempItems2 = new T[tailItemsReverse.Length + tempItems.Length]; Array.Copy(tailItemsReverse, tempItems2, tailItemsReverse.Length); Array.Copy(tempItems, 0, tempItems2, tailItemsReverse.Length, tempItems.Length); InitialItems_Tests(linkedList, tempItems2); //[] Call AddBefore several times remove all of the items linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); for (int i = 0; i < arraySize; ++i) linkedList.RemoveFirst(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); InitialItems_Tests(linkedList, tailItemsReverse); //[] Call AddBefore several times then call Clear linkedList = new LinkedList<T>(); linkedList.AddFirst(headItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.Clear(); linkedList.AddFirst(tailItems[0]); for (int i = 1; i < arraySize; ++i) linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(tailItems[i])); InitialItems_Tests(linkedList, tailItemsReverse); //[] Mix AddBefore and AddAfter calls linkedList = new LinkedList<T>(); linkedList.AddLast(headItems[0]); linkedList.AddLast(tailItems[0]); for (int i = 1; i < arraySize; ++i) { linkedList.AddBefore(linkedList.First, new LinkedListNode<T>(headItems[i])); linkedList.AddAfter(linkedList.Last, new LinkedListNode<T>(tailItems[i])); } tempItems = new T[headItemsReverse.Length + tailItems.Length]; Array.Copy(headItemsReverse, tempItems, headItemsReverse.Length); Array.Copy(tailItems, 0, tempItems, headItemsReverse.Length, tailItems.Length); InitialItems_Tests(linkedList, tempItems); } [Fact] public void AddBefore_LLNode_LLNode_Negative() { LinkedList<T> linkedList = new LinkedList<T>(); LinkedList<T> tempLinkedList = new LinkedList<T>(); int seed = 8293; T[] items; //[] Verify Null node Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(null, new LinkedListNode<T>(CreateT(seed++)))); //"Err_858ahia Expected null node to throws ArgumentNullException\n" InitialItems_Tests(linkedList, new T[0]); //[] Verify Node that is a new Node linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(new LinkedListNode<T>(CreateT(seed++)), new LinkedListNode<T>(CreateT(seed++)))); //"Err_0568ajods Expected Node that is a new Node throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify Node that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(tempLinkedList.Last, new LinkedListNode<T>(CreateT(seed++)))); //"Err_98809ahied Node that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); // Tests for the NewNode //[] Verify Null newNode linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++) }; linkedList.AddLast(items[0]); Assert.Throws<ArgumentNullException>(() => linkedList.AddBefore(linkedList.First, null)); //"Err_0808ajeoia Expected null newNode to throws ArgumentNullException\n" InitialItems_Tests(linkedList, items); //[] Verify newNode that already exists in this collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(linkedList.First, linkedList.Last)); //"Err_58808adjioe Verify newNode that already exists in this collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); //[] Verify newNode that already exists in another collection linkedList = new LinkedList<T>(); items = new T[] { CreateT(seed++), CreateT(seed++) }; linkedList.AddLast(items[0]); linkedList.AddLast(items[1]); tempLinkedList.Clear(); tempLinkedList.AddLast(CreateT(seed++)); tempLinkedList.AddLast(CreateT(seed++)); Assert.Throws<InvalidOperationException>(() => linkedList.AddBefore(linkedList.First, tempLinkedList.Last)); //"Err_54808ajied newNode that already exists in another collection throws InvalidOperationException\n" InitialItems_Tests(linkedList, items); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/IL_Conformance/Old/Conformance_Base/ldc_sub_ovf_i4.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern legacy library mscorlib {} .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } // //====================================== //---- CLASS ---------------- .class public ldc_sub_ovf_i4 { //---- GLOBAL DATA ---------- //---- METHODS -------------- .method public static int32 i4_0(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_1(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_2(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_3(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_4(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_5(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_6(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xD5555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xD5555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_7(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_8(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_9(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_10(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_11(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_12(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_13(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555555 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_14(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_15(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_16(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_17(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_18(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_19(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAB ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAB ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_20(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_21(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_22(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000002 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000002 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_23(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_24(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_25(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000002 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000002 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_26(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAC ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAC ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_27(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555557 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555557 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_28(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_29(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_30(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_31(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_32(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_33(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x2AAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x2AAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_34(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_35(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_36(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_37(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555555 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_38(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555554 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555554 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_39(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xD5555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xD5555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_40(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_41(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_42(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x2AAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x2AAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_43(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAB ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAB ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_44(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_45(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAA9 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAA9 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_46(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_47(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_48(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } //---- CONSTRUCTOR ---------- .method public void ldc_sub_ovf_i4() { .maxstack 0 ret } //---- MAIN ----------------- .method public static int32 main(class [mscorlib]System.String[]) { .entrypoint .maxstack 5 //====== begin testing ====== // -- Min - Min should overflow ldc.i4 0x80000000 ldc.i4 0x80000000 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_0(int32,int32,int32) brfalse FAIL // -- Min - -1 ldc.i4 0x80000000 ldc.i4 0xFFFFFFFF ldc.i4 0x80000001 call int32 ldc_sub_ovf_i4::i4_1(int32,int32,int32) brfalse FAIL // -- Min - 0 ldc.i4 0x80000000 ldc.i4 0x00000000 ldc.i4 0x80000000 call int32 ldc_sub_ovf_i4::i4_2(int32,int32,int32) brfalse FAIL // -- Min - 1 ldc.i4 0x80000000 ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_3(int32,int32,int32) brfalse FAIL // -- Min - Max ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_4(int32,int32,int32) brfalse FAIL // -- Min - Odd ldc.i4 0x80000000 ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_5(int32,int32,int32) brfalse FAIL // -- Min - Even ldc.i4 0x80000000 ldc.i4 0xAAAAAAAA ldc.i4 0xD5555556 call int32 ldc_sub_ovf_i4::i4_6(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- -1 - Min ldc.i4 0xFFFFFFFF ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF call int32 ldc_sub_ovf_i4::i4_7(int32,int32,int32) brfalse FAIL // -- -1 - -1 ldc.i4 0xFFFFFFFF ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_8(int32,int32,int32) brfalse FAIL // -- -1 - 0 ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF call int32 ldc_sub_ovf_i4::i4_9(int32,int32,int32) brfalse FAIL // -- -1 - 1 ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 ldc.i4 0xFFFFFFFE call int32 ldc_sub_ovf_i4::i4_10(int32,int32,int32) brfalse FAIL // -- -1 - Max ldc.i4 0xFFFFFFFF ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 call int32 ldc_sub_ovf_i4::i4_11(int32,int32,int32) brfalse FAIL // -- -1 - Odd ldc.i4 0xFFFFFFFF ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA call int32 ldc_sub_ovf_i4::i4_12(int32,int32,int32) brfalse FAIL // -- -1 - Even ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 call int32 ldc_sub_ovf_i4::i4_13(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- 0 - Min ldc.i4 0x00000000 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_14(int32,int32,int32) brfalse FAIL // -- 0 - -1 ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 call int32 ldc_sub_ovf_i4::i4_15(int32,int32,int32) brfalse FAIL // -- 0 - 0 ldc.i4 0x00000000 ldc.i4 0x00000000 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_16(int32,int32,int32) brfalse FAIL // -- 0 - 1 ldc.i4 0x00000000 ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF call int32 ldc_sub_ovf_i4::i4_17(int32,int32,int32) brfalse FAIL // -- 0 - Max ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF ldc.i4 0x80000001 call int32 ldc_sub_ovf_i4::i4_18(int32,int32,int32) brfalse FAIL // -- 0 - Odd ldc.i4 0x00000000 ldc.i4 0x55555555 ldc.i4 0xAAAAAAAB call int32 ldc_sub_ovf_i4::i4_19(int32,int32,int32) brfalse FAIL // -- 0 - Even ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA ldc.i4 0x55555556 call int32 ldc_sub_ovf_i4::i4_20(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- 1 - Min ldc.i4 0x00000001 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_21(int32,int32,int32) brfalse FAIL // -- 1 - -1 ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF ldc.i4 0x00000002 call int32 ldc_sub_ovf_i4::i4_22(int32,int32,int32) brfalse FAIL // -- 1 - 0 ldc.i4 0x00000001 ldc.i4 0x00000000 ldc.i4 0x00000001 call int32 ldc_sub_ovf_i4::i4_23(int32,int32,int32) brfalse FAIL // -- 1 - 1 ldc.i4 0x00000001 ldc.i4 0x00000001 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_24(int32,int32,int32) brfalse FAIL // -- 1 - Max ldc.i4 0x00000001 ldc.i4 0x7FFFFFFF ldc.i4 0x80000002 call int32 ldc_sub_ovf_i4::i4_25(int32,int32,int32) brfalse FAIL // -- 1 - Odd ldc.i4 0x00000001 ldc.i4 0x55555555 ldc.i4 0xAAAAAAAC call int32 ldc_sub_ovf_i4::i4_26(int32,int32,int32) brfalse FAIL // -- 1 - Even ldc.i4 0x00000001 ldc.i4 0xAAAAAAAA ldc.i4 0x55555557 call int32 ldc_sub_ovf_i4::i4_27(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Max - Min ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_28(int32,int32,int32) brfalse FAIL // -- Max - -1 ldc.i4 0x7FFFFFFF ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_29(int32,int32,int32) brfalse FAIL // -- Max - 0 ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF call int32 ldc_sub_ovf_i4::i4_30(int32,int32,int32) brfalse FAIL // -- Max - 1 ldc.i4 0x7FFFFFFF ldc.i4 0x00000001 ldc.i4 0x7FFFFFFE call int32 ldc_sub_ovf_i4::i4_31(int32,int32,int32) brfalse FAIL // -- Max - Max ldc.i4 0x7FFFFFFF ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_32(int32,int32,int32) brfalse FAIL // -- Max - Odd ldc.i4 0x7FFFFFFF ldc.i4 0x55555555 ldc.i4 0x2AAAAAAA call int32 ldc_sub_ovf_i4::i4_33(int32,int32,int32) brfalse FAIL // -- Max - Even ldc.i4 0x7FFFFFFF ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_34(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Odd - Min ldc.i4 0x55555555 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_35(int32,int32,int32) brfalse FAIL // -- Odd - -1 ldc.i4 0x55555555 ldc.i4 0xFFFFFFFF ldc.i4 0x55555556 call int32 ldc_sub_ovf_i4::i4_36(int32,int32,int32) brfalse FAIL // -- Odd - 0 ldc.i4 0x55555555 ldc.i4 0x00000000 ldc.i4 0x55555555 call int32 ldc_sub_ovf_i4::i4_37(int32,int32,int32) brfalse FAIL // -- Odd - 1 ldc.i4 0x55555555 ldc.i4 0x00000001 ldc.i4 0x55555554 call int32 ldc_sub_ovf_i4::i4_38(int32,int32,int32) brfalse FAIL // -- Odd - Max ldc.i4 0x55555555 ldc.i4 0x7FFFFFFF ldc.i4 0xD5555556 call int32 ldc_sub_ovf_i4::i4_39(int32,int32,int32) brfalse FAIL // -- Odd - Odd ldc.i4 0x55555555 ldc.i4 0x55555555 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_40(int32,int32,int32) brfalse FAIL // -- Odd - Even ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_41(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Even - Min ldc.i4 0xAAAAAAAA ldc.i4 0x80000000 ldc.i4 0x2AAAAAAA call int32 ldc_sub_ovf_i4::i4_42(int32,int32,int32) brfalse FAIL // -- Even - -1 ldc.i4 0xAAAAAAAA ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAB call int32 ldc_sub_ovf_i4::i4_43(int32,int32,int32) brfalse FAIL // -- Even - 0 ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA call int32 ldc_sub_ovf_i4::i4_44(int32,int32,int32) brfalse FAIL // -- Even - 1 ldc.i4 0xAAAAAAAA ldc.i4 0x00000001 ldc.i4 0xAAAAAAA9 call int32 ldc_sub_ovf_i4::i4_45(int32,int32,int32) brfalse FAIL // -- Even - Max ldc.i4 0xAAAAAAAA ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_46(int32,int32,int32) brfalse FAIL // -- Even - Odd ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_47(int32,int32,int32) brfalse FAIL // -- Even - Even ldc.i4 0xAAAAAAAA ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_48(int32,int32,int32) brfalse FAIL //====== end testing ======== //---- branch here on pass -- PASS: ldc.i4 100 br END //---- branch here on fail -- FAIL: ldc.i4 101 //---- return the result ---- END: ret //---- END OF METHOD -------- } //---- EOF ------------------ } .assembly ldc_sub_ovf_i4{}
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern legacy library mscorlib {} .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } // //====================================== //---- CLASS ---------------- .class public ldc_sub_ovf_i4 { //---- GLOBAL DATA ---------- //---- METHODS -------------- .method public static int32 i4_0(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_1(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_2(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_3(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_4(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_5(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_6(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x80000000 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xD5555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xD5555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_7(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_8(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_9(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_10(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_11(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_12(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_13(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555555 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_14(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_15(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_16(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_17(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xFFFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_18(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_19(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAB ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAB ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_20(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_21(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_22(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000002 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000002 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_23(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000001 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_24(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_25(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x80000002 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x80000002 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_26(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAC ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAC ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_27(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x00000001 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555557 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555557 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_28(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_29(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_30(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFF ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_31(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x7FFFFFFE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x7FFFFFFE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_32(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_33(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x2AAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x2AAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_34(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x7FFFFFFF ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_35(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_36(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_37(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555555 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_38(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x55555554 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x55555554 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_39(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xD5555556 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xD5555556 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_40(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_41(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_42(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x80000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x2AAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x2AAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_43(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0xFFFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAB ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAB ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_44(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAAA ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_45(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x00000001 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xAAAAAAA9 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xAAAAAAA9 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_46(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x7FFFFFFF sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_47(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0xEEEEEEEE ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0xEEEEEEEE ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } .method public static int32 i4_48(int32,int32,int32) { .locals (class [mscorlib]System.OverflowException,int32) .maxstack 2 try_start: ldc.i4 0xAAAAAAAA ldc.i4 0xAAAAAAAA sub.ovf //conv.ovf.i4 stloc.1 leave.s try_end try_end: ldloc.1 ldc.i4 0x00000000 ceq br END aHandler: isinst [mscorlib]System.OverflowException stloc 0 leave HEnd HEnd: ldloc 0 brfalse FAIL ldc.i4 0x00000000 ldc.i4 0xEEEEEEEE ceq br END FAIL: ldc.i4 0x00000000 END: ret .try try_start to try_end catch [mscorlib]System.OverflowException handler aHandler to HEnd } //---- CONSTRUCTOR ---------- .method public void ldc_sub_ovf_i4() { .maxstack 0 ret } //---- MAIN ----------------- .method public static int32 main(class [mscorlib]System.String[]) { .entrypoint .maxstack 5 //====== begin testing ====== // -- Min - Min should overflow ldc.i4 0x80000000 ldc.i4 0x80000000 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_0(int32,int32,int32) brfalse FAIL // -- Min - -1 ldc.i4 0x80000000 ldc.i4 0xFFFFFFFF ldc.i4 0x80000001 call int32 ldc_sub_ovf_i4::i4_1(int32,int32,int32) brfalse FAIL // -- Min - 0 ldc.i4 0x80000000 ldc.i4 0x00000000 ldc.i4 0x80000000 call int32 ldc_sub_ovf_i4::i4_2(int32,int32,int32) brfalse FAIL // -- Min - 1 ldc.i4 0x80000000 ldc.i4 0x00000001 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_3(int32,int32,int32) brfalse FAIL // -- Min - Max ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_4(int32,int32,int32) brfalse FAIL // -- Min - Odd ldc.i4 0x80000000 ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_5(int32,int32,int32) brfalse FAIL // -- Min - Even ldc.i4 0x80000000 ldc.i4 0xAAAAAAAA ldc.i4 0xD5555556 call int32 ldc_sub_ovf_i4::i4_6(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- -1 - Min ldc.i4 0xFFFFFFFF ldc.i4 0x80000000 ldc.i4 0x7FFFFFFF call int32 ldc_sub_ovf_i4::i4_7(int32,int32,int32) brfalse FAIL // -- -1 - -1 ldc.i4 0xFFFFFFFF ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_8(int32,int32,int32) brfalse FAIL // -- -1 - 0 ldc.i4 0xFFFFFFFF ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF call int32 ldc_sub_ovf_i4::i4_9(int32,int32,int32) brfalse FAIL // -- -1 - 1 ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 ldc.i4 0xFFFFFFFE call int32 ldc_sub_ovf_i4::i4_10(int32,int32,int32) brfalse FAIL // -- -1 - Max ldc.i4 0xFFFFFFFF ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 call int32 ldc_sub_ovf_i4::i4_11(int32,int32,int32) brfalse FAIL // -- -1 - Odd ldc.i4 0xFFFFFFFF ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA call int32 ldc_sub_ovf_i4::i4_12(int32,int32,int32) brfalse FAIL // -- -1 - Even ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 call int32 ldc_sub_ovf_i4::i4_13(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- 0 - Min ldc.i4 0x00000000 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_14(int32,int32,int32) brfalse FAIL // -- 0 - -1 ldc.i4 0x00000000 ldc.i4 0xFFFFFFFF ldc.i4 0x00000001 call int32 ldc_sub_ovf_i4::i4_15(int32,int32,int32) brfalse FAIL // -- 0 - 0 ldc.i4 0x00000000 ldc.i4 0x00000000 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_16(int32,int32,int32) brfalse FAIL // -- 0 - 1 ldc.i4 0x00000000 ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF call int32 ldc_sub_ovf_i4::i4_17(int32,int32,int32) brfalse FAIL // -- 0 - Max ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF ldc.i4 0x80000001 call int32 ldc_sub_ovf_i4::i4_18(int32,int32,int32) brfalse FAIL // -- 0 - Odd ldc.i4 0x00000000 ldc.i4 0x55555555 ldc.i4 0xAAAAAAAB call int32 ldc_sub_ovf_i4::i4_19(int32,int32,int32) brfalse FAIL // -- 0 - Even ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA ldc.i4 0x55555556 call int32 ldc_sub_ovf_i4::i4_20(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- 1 - Min ldc.i4 0x00000001 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_21(int32,int32,int32) brfalse FAIL // -- 1 - -1 ldc.i4 0x00000001 ldc.i4 0xFFFFFFFF ldc.i4 0x00000002 call int32 ldc_sub_ovf_i4::i4_22(int32,int32,int32) brfalse FAIL // -- 1 - 0 ldc.i4 0x00000001 ldc.i4 0x00000000 ldc.i4 0x00000001 call int32 ldc_sub_ovf_i4::i4_23(int32,int32,int32) brfalse FAIL // -- 1 - 1 ldc.i4 0x00000001 ldc.i4 0x00000001 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_24(int32,int32,int32) brfalse FAIL // -- 1 - Max ldc.i4 0x00000001 ldc.i4 0x7FFFFFFF ldc.i4 0x80000002 call int32 ldc_sub_ovf_i4::i4_25(int32,int32,int32) brfalse FAIL // -- 1 - Odd ldc.i4 0x00000001 ldc.i4 0x55555555 ldc.i4 0xAAAAAAAC call int32 ldc_sub_ovf_i4::i4_26(int32,int32,int32) brfalse FAIL // -- 1 - Even ldc.i4 0x00000001 ldc.i4 0xAAAAAAAA ldc.i4 0x55555557 call int32 ldc_sub_ovf_i4::i4_27(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Max - Min ldc.i4 0x7FFFFFFF ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_28(int32,int32,int32) brfalse FAIL // -- Max - -1 ldc.i4 0x7FFFFFFF ldc.i4 0xFFFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_29(int32,int32,int32) brfalse FAIL // -- Max - 0 ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 ldc.i4 0x7FFFFFFF call int32 ldc_sub_ovf_i4::i4_30(int32,int32,int32) brfalse FAIL // -- Max - 1 ldc.i4 0x7FFFFFFF ldc.i4 0x00000001 ldc.i4 0x7FFFFFFE call int32 ldc_sub_ovf_i4::i4_31(int32,int32,int32) brfalse FAIL // -- Max - Max ldc.i4 0x7FFFFFFF ldc.i4 0x7FFFFFFF ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_32(int32,int32,int32) brfalse FAIL // -- Max - Odd ldc.i4 0x7FFFFFFF ldc.i4 0x55555555 ldc.i4 0x2AAAAAAA call int32 ldc_sub_ovf_i4::i4_33(int32,int32,int32) brfalse FAIL // -- Max - Even ldc.i4 0x7FFFFFFF ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_34(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Odd - Min ldc.i4 0x55555555 ldc.i4 0x80000000 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_35(int32,int32,int32) brfalse FAIL // -- Odd - -1 ldc.i4 0x55555555 ldc.i4 0xFFFFFFFF ldc.i4 0x55555556 call int32 ldc_sub_ovf_i4::i4_36(int32,int32,int32) brfalse FAIL // -- Odd - 0 ldc.i4 0x55555555 ldc.i4 0x00000000 ldc.i4 0x55555555 call int32 ldc_sub_ovf_i4::i4_37(int32,int32,int32) brfalse FAIL // -- Odd - 1 ldc.i4 0x55555555 ldc.i4 0x00000001 ldc.i4 0x55555554 call int32 ldc_sub_ovf_i4::i4_38(int32,int32,int32) brfalse FAIL // -- Odd - Max ldc.i4 0x55555555 ldc.i4 0x7FFFFFFF ldc.i4 0xD5555556 call int32 ldc_sub_ovf_i4::i4_39(int32,int32,int32) brfalse FAIL // -- Odd - Odd ldc.i4 0x55555555 ldc.i4 0x55555555 ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_40(int32,int32,int32) brfalse FAIL // -- Odd - Even ldc.i4 0x55555555 ldc.i4 0xAAAAAAAA ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_41(int32,int32,int32) brfalse FAIL //---------------------------------------------------------- // -- Even - Min ldc.i4 0xAAAAAAAA ldc.i4 0x80000000 ldc.i4 0x2AAAAAAA call int32 ldc_sub_ovf_i4::i4_42(int32,int32,int32) brfalse FAIL // -- Even - -1 ldc.i4 0xAAAAAAAA ldc.i4 0xFFFFFFFF ldc.i4 0xAAAAAAAB call int32 ldc_sub_ovf_i4::i4_43(int32,int32,int32) brfalse FAIL // -- Even - 0 ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 ldc.i4 0xAAAAAAAA call int32 ldc_sub_ovf_i4::i4_44(int32,int32,int32) brfalse FAIL // -- Even - 1 ldc.i4 0xAAAAAAAA ldc.i4 0x00000001 ldc.i4 0xAAAAAAA9 call int32 ldc_sub_ovf_i4::i4_45(int32,int32,int32) brfalse FAIL // -- Even - Max ldc.i4 0xAAAAAAAA ldc.i4 0x7FFFFFFF ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_46(int32,int32,int32) brfalse FAIL // -- Even - Odd ldc.i4 0xAAAAAAAA ldc.i4 0x55555555 ldc.i4 0xEEEEEEEE call int32 ldc_sub_ovf_i4::i4_47(int32,int32,int32) brfalse FAIL // -- Even - Even ldc.i4 0xAAAAAAAA ldc.i4 0xAAAAAAAA ldc.i4 0x00000000 call int32 ldc_sub_ovf_i4::i4_48(int32,int32,int32) brfalse FAIL //====== end testing ======== //---- branch here on pass -- PASS: ldc.i4 100 br END //---- branch here on fail -- FAIL: ldc.i4 101 //---- return the result ---- END: ret //---- END OF METHOD -------- } //---- EOF ------------------ } .assembly ldc_sub_ovf_i4{}
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.SpanTests { public static partial class ReadOnlySpanTests { [Fact] public static void ZeroLengthIndexOf() { ReadOnlySpan<int> sp = new ReadOnlySpan<int>(Array.Empty<int>()); int idx = sp.IndexOf(0); Assert.Equal(-1, idx); } [Fact] public static void TestMatch() { for (int length = 0; length < 32; length++) { int[] a = new int[length]; for (int i = 0; i < length; i++) { a[i] = 10 * (i + 1); } ReadOnlySpan<int> span = new ReadOnlySpan<int>(a); for (int targetIndex = 0; targetIndex < length; targetIndex++) { int target = a[targetIndex]; int idx = span.IndexOf(target); Assert.Equal(targetIndex, idx); } } } [Fact] public static void TestMultipleMatch() { for (int length = 2; length < 32; length++) { int[] a = new int[length]; for (int i = 0; i < length; i++) { a[i] = 10 * (i + 1); } a[length - 1] = 5555; a[length - 2] = 5555; ReadOnlySpan<int> span = new ReadOnlySpan<int>(a); int idx = span.IndexOf(5555); Assert.Equal(length - 2, idx); } } [Fact] public static void OnNoMatchMakeSureEveryElementIsCompared() { for (int length = 0; length < 100; length++) { TIntLog log = new TIntLog(); TInt[] a = new TInt[length]; for (int i = 0; i < length; i++) { a[i] = new TInt(10 * (i + 1), log); } ReadOnlySpan<TInt> span = new ReadOnlySpan<TInt>(a); int idx = span.IndexOf(new TInt(9999, log)); Assert.Equal(-1, idx); // Since we asked for a non-existent value, make sure each element of the array was compared once. // (Strictly speaking, it would not be illegal for IndexOf to compare an element more than once but // that would be a non-optimal implementation and a red flag. So we'll stick with the stricter test.) Assert.Equal(a.Length, log.Count); foreach (TInt elem in a) { int numCompares = log.CountCompares(elem.Value, 9999); Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } [Fact] public static void MakeSureNoChecksGoOutOfRange() { const int GuardValue = 77777; const int GuardLength = 50; Action<int, int> checkForOutOfRangeAccess = delegate (int x, int y) { if (x == GuardValue || y == GuardValue) throw new Exception("Detected out of range access in IndexOf()"); }; for (int length = 0; length < 100; length++) { TInt[] a = new TInt[GuardLength + length + GuardLength]; for (int i = 0; i < a.Length; i++) { a[i] = new TInt(GuardValue, checkForOutOfRangeAccess); } for (int i = 0; i < length; i++) { a[GuardLength + i] = new TInt(10 * (i + 1), checkForOutOfRangeAccess); } ReadOnlySpan<TInt> span = new ReadOnlySpan<TInt>(a, GuardLength, length); int idx = span.IndexOf(new TInt(9999, checkForOutOfRangeAccess)); Assert.Equal(-1, idx); } } [Fact] public static void ZeroLengthIndexOf_String() { ReadOnlySpan<string> sp = new ReadOnlySpan<string>(Array.Empty<string>()); int idx = sp.IndexOf("a"); Assert.Equal(-1, idx); } [Fact] public static void TestMatchIndexOf_String() { for (int length = 0; length < 32; length++) { string[] a = new string[length]; for (int i = 0; i < length; i++) { a[i] = (10 * (i + 1)).ToString(); } ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); for (int targetIndex = 0; targetIndex < length; targetIndex++) { string target = a[targetIndex]; int idx = span.IndexOf(target); Assert.Equal(targetIndex, idx); } } } [Fact] public static void TestNoMatchIndexOf_String() { var rnd = new Random(42); for (int length = 0; length <= byte.MaxValue; length++) { string[] a = new string[length]; string target = (rnd.Next(0, 256)).ToString(); for (int i = 0; i < length; i++) { string val = (i + 1).ToString(); a[i] = val == target ? (target + 1) : val; } ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); int idx = span.IndexOf(target); Assert.Equal(-1, idx); } } [Fact] public static void TestMultipleMatchIndexOf_String() { for (int length = 2; length < 32; length++) { string[] a = new string[length]; for (int i = 0; i < length; i++) { a[i] = (10 * (i + 1)).ToString(); } a[length - 1] = "5555"; a[length - 2] = "5555"; ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); int idx = span.IndexOf("5555"); Assert.Equal(length - 2, idx); } } [Theory] [MemberData(nameof(TestHelpers.IndexOfNullData), MemberType = typeof(TestHelpers))] public static void IndexOfNull_String(string[] spanInput, int expected) { ReadOnlySpan<string> theStrings = spanInput; Assert.Equal(expected, theStrings.IndexOf((string)null)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.SpanTests { public static partial class ReadOnlySpanTests { [Fact] public static void ZeroLengthIndexOf() { ReadOnlySpan<int> sp = new ReadOnlySpan<int>(Array.Empty<int>()); int idx = sp.IndexOf(0); Assert.Equal(-1, idx); } [Fact] public static void TestMatch() { for (int length = 0; length < 32; length++) { int[] a = new int[length]; for (int i = 0; i < length; i++) { a[i] = 10 * (i + 1); } ReadOnlySpan<int> span = new ReadOnlySpan<int>(a); for (int targetIndex = 0; targetIndex < length; targetIndex++) { int target = a[targetIndex]; int idx = span.IndexOf(target); Assert.Equal(targetIndex, idx); } } } [Fact] public static void TestMultipleMatch() { for (int length = 2; length < 32; length++) { int[] a = new int[length]; for (int i = 0; i < length; i++) { a[i] = 10 * (i + 1); } a[length - 1] = 5555; a[length - 2] = 5555; ReadOnlySpan<int> span = new ReadOnlySpan<int>(a); int idx = span.IndexOf(5555); Assert.Equal(length - 2, idx); } } [Fact] public static void OnNoMatchMakeSureEveryElementIsCompared() { for (int length = 0; length < 100; length++) { TIntLog log = new TIntLog(); TInt[] a = new TInt[length]; for (int i = 0; i < length; i++) { a[i] = new TInt(10 * (i + 1), log); } ReadOnlySpan<TInt> span = new ReadOnlySpan<TInt>(a); int idx = span.IndexOf(new TInt(9999, log)); Assert.Equal(-1, idx); // Since we asked for a non-existent value, make sure each element of the array was compared once. // (Strictly speaking, it would not be illegal for IndexOf to compare an element more than once but // that would be a non-optimal implementation and a red flag. So we'll stick with the stricter test.) Assert.Equal(a.Length, log.Count); foreach (TInt elem in a) { int numCompares = log.CountCompares(elem.Value, 9999); Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } [Fact] public static void MakeSureNoChecksGoOutOfRange() { const int GuardValue = 77777; const int GuardLength = 50; Action<int, int> checkForOutOfRangeAccess = delegate (int x, int y) { if (x == GuardValue || y == GuardValue) throw new Exception("Detected out of range access in IndexOf()"); }; for (int length = 0; length < 100; length++) { TInt[] a = new TInt[GuardLength + length + GuardLength]; for (int i = 0; i < a.Length; i++) { a[i] = new TInt(GuardValue, checkForOutOfRangeAccess); } for (int i = 0; i < length; i++) { a[GuardLength + i] = new TInt(10 * (i + 1), checkForOutOfRangeAccess); } ReadOnlySpan<TInt> span = new ReadOnlySpan<TInt>(a, GuardLength, length); int idx = span.IndexOf(new TInt(9999, checkForOutOfRangeAccess)); Assert.Equal(-1, idx); } } [Fact] public static void ZeroLengthIndexOf_String() { ReadOnlySpan<string> sp = new ReadOnlySpan<string>(Array.Empty<string>()); int idx = sp.IndexOf("a"); Assert.Equal(-1, idx); } [Fact] public static void TestMatchIndexOf_String() { for (int length = 0; length < 32; length++) { string[] a = new string[length]; for (int i = 0; i < length; i++) { a[i] = (10 * (i + 1)).ToString(); } ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); for (int targetIndex = 0; targetIndex < length; targetIndex++) { string target = a[targetIndex]; int idx = span.IndexOf(target); Assert.Equal(targetIndex, idx); } } } [Fact] public static void TestNoMatchIndexOf_String() { var rnd = new Random(42); for (int length = 0; length <= byte.MaxValue; length++) { string[] a = new string[length]; string target = (rnd.Next(0, 256)).ToString(); for (int i = 0; i < length; i++) { string val = (i + 1).ToString(); a[i] = val == target ? (target + 1) : val; } ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); int idx = span.IndexOf(target); Assert.Equal(-1, idx); } } [Fact] public static void TestMultipleMatchIndexOf_String() { for (int length = 2; length < 32; length++) { string[] a = new string[length]; for (int i = 0; i < length; i++) { a[i] = (10 * (i + 1)).ToString(); } a[length - 1] = "5555"; a[length - 2] = "5555"; ReadOnlySpan<string> span = new ReadOnlySpan<string>(a); int idx = span.IndexOf("5555"); Assert.Equal(length - 2, idx); } } [Theory] [MemberData(nameof(TestHelpers.IndexOfNullData), MemberType = typeof(TestHelpers))] public static void IndexOfNull_String(string[] spanInput, int expected) { ReadOnlySpan<string> theStrings = spanInput; Assert.Equal(expected, theStrings.IndexOf((string)null)); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/coreclr/nativeaot/Runtime/arm/CallDescrWorker.asm
;; Licensed to the .NET Foundation under one or more agreements. ;; The .NET Foundation licenses this file to you under the MIT license. #include "AsmMacros.h" TEXTAREA ;;----------------------------------------------------------------------------- ;; This helper routine enregisters the appropriate arguments and makes the ;; actual call. ;;----------------------------------------------------------------------------- ;;void RhCallDescrWorker(CallDescrData * pCallDescrData); NESTED_ENTRY RhCallDescrWorker PROLOG_PUSH {r4,r5,r7,lr} PROLOG_STACK_SAVE r7 mov r5,r0 ; save pCallDescrData in r5 ldr r1, [r5,#OFFSETOF__CallDescrData__numStackSlots] cbz r1, Ldonestack ;; Add frame padding to ensure frame size is a multiple of 8 (a requirement of the OS ABI). ;; We push four registers (above) and numStackSlots arguments (below). If this comes to an odd number ;; of slots we must pad with another. This simplifies to "if the low bit of numStackSlots is set, ;; extend the stack another four bytes". lsls r2, r1, #2 and r3, r2, #4 sub sp, sp, r3 ;; This loop copies numStackSlots words ;; from [pSrcEnd-4,pSrcEnd-8,...] to [sp-4,sp-8,...] ldr r0, [r5,#OFFSETOF__CallDescrData__pSrc] add r0,r0,r2 Lstackloop ldr r2, [r0,#-4]! str r2, [sp,#-4]! subs r1, r1, #1 bne Lstackloop Ldonestack ;; If FP arguments are supplied in registers (r3 != NULL) then initialize all of them from the pointer ;; given in r3. Do not use "it" since it faults in floating point even when the instruction is not executed. ldr r3, [r5,#OFFSETOF__CallDescrData__pFloatArgumentRegisters] cbz r3, LNoFloatingPoint vldm r3, {s0-s15} LNoFloatingPoint ;; Copy [pArgumentRegisters, ..., pArgumentRegisters + 12] ;; into r0, ..., r3 ldr r4, [r5,#OFFSETOF__CallDescrData__pArgumentRegisters] ldm r4, {r0-r3} CHECK_STACK_ALIGNMENT ;; call pTarget ;; Note that remoting expect target in r4. ldr r4, [r5,#OFFSETOF__CallDescrData__pTarget] blx r4 EXPORT_POINTER_TO_ADDRESS PointerToReturnFromCallDescrThunk ;; Symbol used to identify thunk call to managed function so the special ;; case unwinder can unwind through this function. Sadly we cannot directly ;; export this symbol right now because it confuses DIA unwinder to believe ;; it's the beginning of a new method, therefore we export the address ;; of an auxiliary variable holding the address instead. ldr r3, [r5,#OFFSETOF__CallDescrData__fpReturnSize] ;; Save FP return value if appropriate cbz r3, LFloatingPointReturnDone ;; Float return case ;; Do not use "it" since it faults in floating point even when the instruction is not executed. cmp r3, #4 bne LNoFloatReturn vmov r0, s0 b LFloatingPointReturnDone LNoFloatReturn ;; Double return case ;; Do not use "it" since it faults in floating point even when the instruction is not executed. cmp r3, #8 bne LNoDoubleReturn vmov r0, r1, s0, s1 b LFloatingPointReturnDone LNoDoubleReturn ; Unlike desktop returnValue is a pointer to a return buffer, not the buffer itself ldr r2, [r5, #OFFSETOF__CallDescrData__pReturnBuffer] cmp r3, #16 bne LNoFloatHFAReturn vstm r2, {s0-s3} b LReturnDone LNoFloatHFAReturn cmp r3, #32 bne LNoDoubleHFAReturn vstm r2, {d0-d3} b LReturnDone LNoDoubleHFAReturn EMIT_BREAKPOINT ; Unreachable LFloatingPointReturnDone ; Unlike desktop returnValue is a pointer to a return buffer, not the buffer itself ldr r5, [r5, #OFFSETOF__CallDescrData__pReturnBuffer] ;; Save return value into retbuf str r0, [r5, #(0)] str r1, [r5, #(4)] LReturnDone #ifdef _DEBUG ;; trash the floating point registers to ensure that the HFA return values ;; won't survive by accident vldm sp, {d0-d3} #endif EPILOG_STACK_RESTORE r7 EPILOG_POP {r4,r5,r7,pc} NESTED_END RhCallDescrWorker END
;; Licensed to the .NET Foundation under one or more agreements. ;; The .NET Foundation licenses this file to you under the MIT license. #include "AsmMacros.h" TEXTAREA ;;----------------------------------------------------------------------------- ;; This helper routine enregisters the appropriate arguments and makes the ;; actual call. ;;----------------------------------------------------------------------------- ;;void RhCallDescrWorker(CallDescrData * pCallDescrData); NESTED_ENTRY RhCallDescrWorker PROLOG_PUSH {r4,r5,r7,lr} PROLOG_STACK_SAVE r7 mov r5,r0 ; save pCallDescrData in r5 ldr r1, [r5,#OFFSETOF__CallDescrData__numStackSlots] cbz r1, Ldonestack ;; Add frame padding to ensure frame size is a multiple of 8 (a requirement of the OS ABI). ;; We push four registers (above) and numStackSlots arguments (below). If this comes to an odd number ;; of slots we must pad with another. This simplifies to "if the low bit of numStackSlots is set, ;; extend the stack another four bytes". lsls r2, r1, #2 and r3, r2, #4 sub sp, sp, r3 ;; This loop copies numStackSlots words ;; from [pSrcEnd-4,pSrcEnd-8,...] to [sp-4,sp-8,...] ldr r0, [r5,#OFFSETOF__CallDescrData__pSrc] add r0,r0,r2 Lstackloop ldr r2, [r0,#-4]! str r2, [sp,#-4]! subs r1, r1, #1 bne Lstackloop Ldonestack ;; If FP arguments are supplied in registers (r3 != NULL) then initialize all of them from the pointer ;; given in r3. Do not use "it" since it faults in floating point even when the instruction is not executed. ldr r3, [r5,#OFFSETOF__CallDescrData__pFloatArgumentRegisters] cbz r3, LNoFloatingPoint vldm r3, {s0-s15} LNoFloatingPoint ;; Copy [pArgumentRegisters, ..., pArgumentRegisters + 12] ;; into r0, ..., r3 ldr r4, [r5,#OFFSETOF__CallDescrData__pArgumentRegisters] ldm r4, {r0-r3} CHECK_STACK_ALIGNMENT ;; call pTarget ;; Note that remoting expect target in r4. ldr r4, [r5,#OFFSETOF__CallDescrData__pTarget] blx r4 EXPORT_POINTER_TO_ADDRESS PointerToReturnFromCallDescrThunk ;; Symbol used to identify thunk call to managed function so the special ;; case unwinder can unwind through this function. Sadly we cannot directly ;; export this symbol right now because it confuses DIA unwinder to believe ;; it's the beginning of a new method, therefore we export the address ;; of an auxiliary variable holding the address instead. ldr r3, [r5,#OFFSETOF__CallDescrData__fpReturnSize] ;; Save FP return value if appropriate cbz r3, LFloatingPointReturnDone ;; Float return case ;; Do not use "it" since it faults in floating point even when the instruction is not executed. cmp r3, #4 bne LNoFloatReturn vmov r0, s0 b LFloatingPointReturnDone LNoFloatReturn ;; Double return case ;; Do not use "it" since it faults in floating point even when the instruction is not executed. cmp r3, #8 bne LNoDoubleReturn vmov r0, r1, s0, s1 b LFloatingPointReturnDone LNoDoubleReturn ; Unlike desktop returnValue is a pointer to a return buffer, not the buffer itself ldr r2, [r5, #OFFSETOF__CallDescrData__pReturnBuffer] cmp r3, #16 bne LNoFloatHFAReturn vstm r2, {s0-s3} b LReturnDone LNoFloatHFAReturn cmp r3, #32 bne LNoDoubleHFAReturn vstm r2, {d0-d3} b LReturnDone LNoDoubleHFAReturn EMIT_BREAKPOINT ; Unreachable LFloatingPointReturnDone ; Unlike desktop returnValue is a pointer to a return buffer, not the buffer itself ldr r5, [r5, #OFFSETOF__CallDescrData__pReturnBuffer] ;; Save return value into retbuf str r0, [r5, #(0)] str r1, [r5, #(4)] LReturnDone #ifdef _DEBUG ;; trash the floating point registers to ensure that the HFA return values ;; won't survive by accident vldm sp, {d0-d3} #endif EPILOG_STACK_RESTORE r7 EPILOG_POP {r4,r5,r7,pc} NESTED_END RhCallDescrWorker END
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest295/Generated295.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated295 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public sequential sealed MyStruct345`2<T0, T1> extends [mscorlib]System.ValueType implements class IBase2`2<class BaseClass0,!T1>, IBase0 { .pack 0 .size 1 .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "MyStruct345::Method7.2787<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method0() cil managed noinlining { ldstr "MyStruct345::Method0.2788()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method0'() cil managed noinlining { .override method instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ret } .method public hidebysig virtual instance string Method1() cil managed noinlining { ldstr "MyStruct345::Method1.2790()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method1'() cil managed noinlining { .override method instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ret } .method public hidebysig newslot virtual instance string Method2<M0>() cil managed noinlining { ldstr "MyStruct345::Method2.2792<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method2'<M0>() cil managed noinlining { .override method instance string IBase0::Method2<[1]>() ldstr "MyStruct345::Method2.MI.2793<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance string Method3<M0>() cil managed noinlining { ldstr "MyStruct345::Method3.2794<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method3'<M0>() cil managed noinlining { .override method instance string IBase0::Method3<[1]>() ldstr "MyStruct345::Method3.MI.2795<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot instance string ClassMethod684() cil managed noinlining { ldstr "MyStruct345::ClassMethod684.2796()" ret } .method public hidebysig newslot instance string ClassMethod685<M0>() cil managed noinlining { ldstr "MyStruct345::ClassMethod685.2797<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance bool Equals(object obj) cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance int32 GetHashCode() cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance string ToString() cil managed { ldstr "" ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class interface public abstract IBase0 { .method public hidebysig newslot abstract virtual instance string Method0() cil managed { } .method public hidebysig newslot abstract virtual instance string Method1() cil managed { } .method public hidebysig newslot abstract virtual instance string Method2<M0>() cil managed { } .method public hidebysig newslot abstract virtual instance string Method3<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated295 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase0<(IBase0)W>(!!W inst, string exp) cil managed { .maxstack 9 .locals init (string[] actualResults) ldc.i4.s 4 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase0<(IBase0)W>(!!W inst, string exp)" ldc.i4.s 4 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.T.T<T0,T1,(valuetype MyStruct345`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.T.T<T0,T1,(valuetype MyStruct345`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.T<T1,(valuetype MyStruct345`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.T<T1,(valuetype MyStruct345`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.A<(valuetype MyStruct345`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.A<(valuetype MyStruct345`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.B<(valuetype MyStruct345`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.B<(valuetype MyStruct345`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.T<T1,(valuetype MyStruct345`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.T<T1,(valuetype MyStruct345`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.A<(valuetype MyStruct345`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.A<(valuetype MyStruct345`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.B<(valuetype MyStruct345`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.B<(valuetype MyStruct345`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_1) ldloca V_1 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloca V_1 dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ToString() pop pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_2) ldloca V_2 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloca V_2 dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ToString() pop pop ldloc V_2 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_3) ldloca V_3 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloca V_3 dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ToString() pop pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_4) ldloca V_4 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloca V_4 dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ToString() pop pop ldloc V_4 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_5) ldloca V_5 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.A<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .try { ldloc V_5 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_6) ldloca V_6 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_6 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_7) ldloca V_7 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV12 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV12} LV12: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.A<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV13 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV13} LV13: .try { ldloc V_7 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV14 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV14} LV14: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV15 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV15} LV15: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV16 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV16} LV16: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV17 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV17} LV17: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_8) ldloca V_8 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV18 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV18} LV18: .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV19 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV19} LV19: .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV20 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV20} LV20: .try { ldloc V_8 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV21 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV21} LV21: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_9) ldloca V_9 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.A<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_10) ldloca V_10 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_11) ldloca V_11 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.A<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_12) ldloca V_12 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_13) ldloca V_13 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldnull ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ToString() calli default string(object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_14) ldloca V_14 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldnull ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ToString() calli default string(object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_15) ldloca V_15 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldnull ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ToString() calli default string(object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_16) ldloca V_16 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldnull ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ToString() calli default string(object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated295::MethodCallingTest() call void Generated295::ConstrainedCallsTest() call void Generated295::StructConstrainedInterfaceCallsTest() call void Generated295::CalliTest() ldc.i4 100 ret } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated295 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public sequential sealed MyStruct345`2<T0, T1> extends [mscorlib]System.ValueType implements class IBase2`2<class BaseClass0,!T1>, IBase0 { .pack 0 .size 1 .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "MyStruct345::Method7.2787<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method0() cil managed noinlining { ldstr "MyStruct345::Method0.2788()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method0'() cil managed noinlining { .override method instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ret } .method public hidebysig virtual instance string Method1() cil managed noinlining { ldstr "MyStruct345::Method1.2790()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method1'() cil managed noinlining { .override method instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ret } .method public hidebysig newslot virtual instance string Method2<M0>() cil managed noinlining { ldstr "MyStruct345::Method2.2792<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method2'<M0>() cil managed noinlining { .override method instance string IBase0::Method2<[1]>() ldstr "MyStruct345::Method2.MI.2793<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance string Method3<M0>() cil managed noinlining { ldstr "MyStruct345::Method3.2794<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method3'<M0>() cil managed noinlining { .override method instance string IBase0::Method3<[1]>() ldstr "MyStruct345::Method3.MI.2795<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot instance string ClassMethod684() cil managed noinlining { ldstr "MyStruct345::ClassMethod684.2796()" ret } .method public hidebysig newslot instance string ClassMethod685<M0>() cil managed noinlining { ldstr "MyStruct345::ClassMethod685.2797<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance bool Equals(object obj) cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance int32 GetHashCode() cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance string ToString() cil managed { ldstr "" ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class interface public abstract IBase0 { .method public hidebysig newslot abstract virtual instance string Method0() cil managed { } .method public hidebysig newslot abstract virtual instance string Method1() cil managed { } .method public hidebysig newslot abstract virtual instance string Method2<M0>() cil managed { } .method public hidebysig newslot abstract virtual instance string Method3<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated295 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase0<(IBase0)W>(!!W inst, string exp) cil managed { .maxstack 9 .locals init (string[] actualResults) ldc.i4.s 4 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase0<(IBase0)W>(!!W inst, string exp)" ldc.i4.s 4 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.T.T<T0,T1,(valuetype MyStruct345`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.T.T<T0,T1,(valuetype MyStruct345`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<!!T0,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.T<T1,(valuetype MyStruct345`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.T<T1,(valuetype MyStruct345`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.A<(valuetype MyStruct345`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.A<(valuetype MyStruct345`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass0> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.A.B<(valuetype MyStruct345`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.A.B<(valuetype MyStruct345`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass0,class BaseClass1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.T<T1,(valuetype MyStruct345`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.T<T1,(valuetype MyStruct345`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,!!T1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.A<(valuetype MyStruct345`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.A<(valuetype MyStruct345`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass0> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct345.B.B<(valuetype MyStruct345`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 10 .locals init (string[] actualResults) ldc.i4.s 5 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct345.B.B<(valuetype MyStruct345`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 5 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. valuetype MyStruct345`2<class BaseClass1,class BaseClass1> callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_1) ldloca V_1 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloca V_1 dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ToString() pop pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_2) ldloca V_2 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloca V_2 dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ToString() pop pop ldloc V_2 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_3) ldloca V_3 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloca V_3 dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ToString() pop pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_4) ldloca V_4 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloca V_4 dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method0() ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method1() ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod684() ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod685<object>() ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type MyStruct345" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ToString() pop pop ldloc V_4 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> dup callvirt instance string IBase0::Method0() ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_5) ldloca V_5 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.A<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .try { ldloc V_5 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .try { ldloc V_5 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_6) ldloca V_6 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .try { ldloc V_6 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_6 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_7) ldloca V_7 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV12 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV12} LV12: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.A<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV13 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV13} LV13: .try { ldloc V_7 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV14 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV14} LV14: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV15 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV15} LV15: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV16 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV16} LV16: .try { ldloc V_7 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV17 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV17} LV17: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_8) ldloca V_8 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV18 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV18} LV18: .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV19 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV19} LV19: .try { ldloc V_8 ldstr "MyStruct345::Method7.2787<System.Object>()#" call void Generated295::M.IBase2.A.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV20 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV20} LV20: .try { ldloc V_8 ldstr "MyStruct345::Method0.MI.2789()#MyStruct345::Method1.MI.2791()#MyStruct345::Method2.MI.2793<System.Object>()#MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.IBase0<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV21 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV21} LV21: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_9) ldloca V_9 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_9 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.A<valuetype MyStruct345`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_10) ldloca V_10 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_10 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.A.B<valuetype MyStruct345`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_11) ldloca V_11 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.T<class BaseClass0,valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_11 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.A<valuetype MyStruct345`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_12) ldloca V_12 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.T<class BaseClass1,valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_12 ldstr "MyStruct345::Method7.2787<System.Object>()#" + "MyStruct345::Method0.MI.2789()#" + "MyStruct345::Method1.MI.2791()#" + "MyStruct345::Method2.MI.2793<System.Object>()#" + "MyStruct345::Method3.MI.2795<System.Object>()#" call void Generated295::M.MyStruct345.B.B<valuetype MyStruct345`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass0> V_13) ldloca V_13 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldnull ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass0>::ToString() calli default string(object) pop ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct345`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass0,class BaseClass1> V_14) ldloca V_14 initobj valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldnull ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass0,class BaseClass1>::ToString() calli default string(object) pop ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct345`2<class BaseClass0,class BaseClass1> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass0> V_15) ldloca V_15 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldnull ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass0>::ToString() calli default string(object) pop ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct345`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct345`2<class BaseClass1,class BaseClass1> V_16) ldloca V_16 initobj valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method0() calli default string(object) ldstr "MyStruct345::Method0.2788()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method1() calli default string(object) ldstr "MyStruct345::Method1.2790()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.2792<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.2794<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod684() calli default string(object) ldstr "MyStruct345::ClassMethod684.2796()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ClassMethod685<object>() calli default string(object) ldstr "MyStruct345::ClassMethod685.2797<System.Object>()" ldstr "valuetype MyStruct345`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldnull ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance bool valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct345`2<class BaseClass1,class BaseClass1>::ToString() calli default string(object) pop ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct345::Method7.2787<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method0() calli default string(object) ldstr "MyStruct345::Method0.MI.2789()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method1() calli default string(object) ldstr "MyStruct345::Method1.MI.2791()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method2<object>() calli default string(object) ldstr "MyStruct345::Method2.MI.2793<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct345`2<class BaseClass1,class BaseClass1> ldvirtftn instance string IBase0::Method3<object>() calli default string(object) ldstr "MyStruct345::Method3.MI.2795<System.Object>()" ldstr "IBase0 on type valuetype MyStruct345`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated295::MethodCallingTest() call void Generated295::ConstrainedCallsTest() call void Generated295::StructConstrainedInterfaceCallsTest() call void Generated295::CalliTest() ldc.i4 100 ret } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector64/GreaterThanOrEqual.UInt32.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void GreaterThanOrEqualUInt32() { var test = new VectorBinaryOpTest__GreaterThanOrEqualUInt32(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__GreaterThanOrEqualUInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt32> _fld1; public Vector64<UInt32> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__GreaterThanOrEqualUInt32 testClass) { var result = Vector64.GreaterThanOrEqual(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector64<UInt32> _clsVar1; private static Vector64<UInt32> _clsVar2; private Vector64<UInt32> _fld1; private Vector64<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__GreaterThanOrEqualUInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); } public VectorBinaryOpTest__GreaterThanOrEqualUInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.GreaterThanOrEqual( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector64).GetMethod(nameof(Vector64.GreaterThanOrEqual), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.GreaterThanOrEqual), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.GreaterThanOrEqual( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr); var result = Vector64.GreaterThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__GreaterThanOrEqualUInt32(); var result = Vector64.GreaterThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.GreaterThanOrEqual(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector64.GreaterThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector64<UInt32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((left[0] >= right[0]) ? uint.MaxValue : 0)) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != ((left[i] >= right[i]) ? uint.MaxValue : 0)) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.GreaterThanOrEqual)}<UInt32>(Vector64<UInt32>, Vector64<UInt32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void GreaterThanOrEqualUInt32() { var test = new VectorBinaryOpTest__GreaterThanOrEqualUInt32(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__GreaterThanOrEqualUInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt32> _fld1; public Vector64<UInt32> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__GreaterThanOrEqualUInt32 testClass) { var result = Vector64.GreaterThanOrEqual(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector64<UInt32> _clsVar1; private static Vector64<UInt32> _clsVar2; private Vector64<UInt32> _fld1; private Vector64<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__GreaterThanOrEqualUInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); } public VectorBinaryOpTest__GreaterThanOrEqualUInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.GreaterThanOrEqual( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector64).GetMethod(nameof(Vector64.GreaterThanOrEqual), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.GreaterThanOrEqual), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.GreaterThanOrEqual( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr); var result = Vector64.GreaterThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__GreaterThanOrEqualUInt32(); var result = Vector64.GreaterThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.GreaterThanOrEqual(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector64.GreaterThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector64<UInt32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((left[0] >= right[0]) ? uint.MaxValue : 0)) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != ((left[i] >= right[i]) ? uint.MaxValue : 0)) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.GreaterThanOrEqual)}<UInt32>(Vector64<UInt32>, Vector64<UInt32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest256/Generated256.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated256.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated256.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Private.Xml/tests/Xslt/TestFiles/TestData/xsltc/baseline/dft4.txt
Microsoft (R) XSLT Compiler version 2.0.61009 for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2007. All rights reserved. fatal error : Error saving assembly 'D:\OASys\Working\dft4.dll'. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Microsoft (R) XSLT Compiler version 2.0.61009 for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2007. All rights reserved. fatal error : Error saving assembly 'D:\OASys\Working\dft4.dll'. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/Common/src/Interop/Windows/Kernel32/Interop.DuplicateHandle_SafeWaitHandle.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { [LibraryImport(Libraries.Kernel32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool DuplicateHandle( IntPtr hSourceProcessHandle, SafeHandle hSourceHandle, IntPtr hTargetProcess, out SafeWaitHandle targetHandle, int dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwOptions ); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { [LibraryImport(Libraries.Kernel32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool DuplicateHandle( IntPtr hSourceProcessHandle, SafeHandle hSourceHandle, IntPtr hTargetProcess, out SafeWaitHandle targetHandle, int dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwOptions ); } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest1292/Generated1292.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated1292.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Generated1292.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\TestFramework\TestFramework.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/MultiplyWideningLower.Vector64.UInt16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void MultiplyWideningLower_Vector64_UInt16() { var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt16[] inArray1, UInt16[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt16>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt16> _fld1; public Vector64<UInt16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 testClass) { var result = AdvSimd.MultiplyWideningLower(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 testClass) { fixed (Vector64<UInt16>* pFld1 = &_fld1) fixed (Vector64<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt16[] _data1 = new UInt16[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static Vector64<UInt16> _clsVar1; private static Vector64<UInt16> _clsVar2; private Vector64<UInt16> _fld1; private Vector64<UInt16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); } public SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.MultiplyWideningLower( Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyWideningLower), new Type[] { typeof(Vector64<UInt16>), typeof(Vector64<UInt16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyWideningLower), new Type[] { typeof(Vector64<UInt16>), typeof(Vector64<UInt16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.MultiplyWideningLower( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt16>* pClsVar1 = &_clsVar1) fixed (Vector64<UInt16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pClsVar1)), AdvSimd.LoadVector64((UInt16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr); var result = AdvSimd.MultiplyWideningLower(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.MultiplyWideningLower(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); var result = AdvSimd.MultiplyWideningLower(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); fixed (Vector64<UInt16>* pFld1 = &test._fld1) fixed (Vector64<UInt16>* pFld2 = &test._fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.MultiplyWideningLower(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt16>* pFld1 = &_fld1) fixed (Vector64<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyWideningLower(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(&test._fld1)), AdvSimd.LoadVector64((UInt16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<UInt16> op1, Vector64<UInt16> op2, void* result, [CallerMemberName] string method = "") { UInt16[] inArray1 = new UInt16[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt16[] inArray1 = new UInt16[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt16[] left, UInt16[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.MultiplyWidening(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.MultiplyWideningLower)}<UInt32>(Vector64<UInt16>, Vector64<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void MultiplyWideningLower_Vector64_UInt16() { var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt16[] inArray1, UInt16[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt16>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt16> _fld1; public Vector64<UInt16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 testClass) { var result = AdvSimd.MultiplyWideningLower(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16 testClass) { fixed (Vector64<UInt16>* pFld1 = &_fld1) fixed (Vector64<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt16[] _data1 = new UInt16[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static Vector64<UInt16> _clsVar1; private static Vector64<UInt16> _clsVar2; private Vector64<UInt16> _fld1; private Vector64<UInt16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); } public SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt16(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.MultiplyWideningLower( Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyWideningLower), new Type[] { typeof(Vector64<UInt16>), typeof(Vector64<UInt16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyWideningLower), new Type[] { typeof(Vector64<UInt16>), typeof(Vector64<UInt16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.MultiplyWideningLower( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt16>* pClsVar1 = &_clsVar1) fixed (Vector64<UInt16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pClsVar1)), AdvSimd.LoadVector64((UInt16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt16>>(_dataTable.inArray2Ptr); var result = AdvSimd.MultiplyWideningLower(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((UInt16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.MultiplyWideningLower(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); var result = AdvSimd.MultiplyWideningLower(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__MultiplyWideningLower_Vector64_UInt16(); fixed (Vector64<UInt16>* pFld1 = &test._fld1) fixed (Vector64<UInt16>* pFld2 = &test._fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.MultiplyWideningLower(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt16>* pFld1 = &_fld1) fixed (Vector64<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(pFld1)), AdvSimd.LoadVector64((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyWideningLower(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyWideningLower( AdvSimd.LoadVector64((UInt16*)(&test._fld1)), AdvSimd.LoadVector64((UInt16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<UInt16> op1, Vector64<UInt16> op2, void* result, [CallerMemberName] string method = "") { UInt16[] inArray1 = new UInt16[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt16[] inArray1 = new UInt16[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt16[] left, UInt16[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.MultiplyWidening(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.MultiplyWideningLower)}<UInt32>(Vector64<UInt16>, Vector64<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Console/tests/RedirectedStream.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using Microsoft.DotNet.RemoteExecutor; using Microsoft.DotNet.XUnitExtensions; using Xunit; public class RedirectedStream { [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] // the CI system redirects stdout, so we can only really test the redirected behavior. public static void InputRedirect() { RunRemote(() => { Assert.True(Console.IsInputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardInput = true }); } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OutputRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsOutputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardOutput = true }); } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void ErrorRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsErrorRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardError = true }); } [Fact] public static void InvokeRedirected() { // We can't be sure of the state of stdin/stdout/stderr redirects, so we can't validate // the results of the Redirected properties one way or the other, but we can at least // invoke them to ensure that no exceptions are thrown. bool result; result = Console.IsInputRedirected; result = Console.IsOutputRedirected; result = Console.IsErrorRedirected; } private static void RunRemote(Func<int> func, ProcessStartInfo psi = null) { var options = new RemoteInvokeOptions(); if (psi != null) { options.StartInfo = psi; } RemoteExecutor.Invoke(func, options).Dispose(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using Microsoft.DotNet.RemoteExecutor; using Microsoft.DotNet.XUnitExtensions; using Xunit; public class RedirectedStream { [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] // the CI system redirects stdout, so we can only really test the redirected behavior. public static void InputRedirect() { RunRemote(() => { Assert.True(Console.IsInputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardInput = true }); } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OutputRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsOutputRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardOutput = true }); } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void ErrorRedirect() // the CI system redirects stdout, so we can only really test the redirected behavior. { RunRemote(() => { Assert.True(Console.IsErrorRedirected); return 42; }, new ProcessStartInfo() { RedirectStandardError = true }); } [Fact] public static void InvokeRedirected() { // We can't be sure of the state of stdin/stdout/stderr redirects, so we can't validate // the results of the Redirected properties one way or the other, but we can at least // invoke them to ensure that no exceptions are thrown. bool result; result = Console.IsInputRedirected; result = Console.IsOutputRedirected; result = Console.IsErrorRedirected; } private static void RunRemote(Func<int> func, ProcessStartInfo psi = null) { var options = new RemoteInvokeOptions(); if (psi != null) { options.StartInfo = psi; } RemoteExecutor.Invoke(func, options).Dispose(); } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b27658/b27658.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).il" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).il" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/ReverseElement16.Vector128.Int32.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ReverseElement16_Vector128_Int32() { var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int32> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 testClass) { var result = AdvSimd.ReverseElement16(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 testClass) { fixed (Vector128<Int32>* pFld1 = &_fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Vector128<Int32> _clsVar1; private Vector128<Int32> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__ReverseElement16_Vector128_Int32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public SimpleUnaryOpTest__ReverseElement16_Vector128_Int32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ReverseElement16( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ReverseElement16), new Type[] { typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ReverseElement16), new Type[] { typeof(Vector128<Int32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ReverseElement16( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int32>* pClsVar1 = &_clsVar1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr); var result = AdvSimd.ReverseElement16(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)); var result = AdvSimd.ReverseElement16(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); var result = AdvSimd.ReverseElement16(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); fixed (Vector128<Int32>* pFld1 = &test._fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ReverseElement16(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int32>* pFld1 = &_fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.ReverseElement16(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int32> op1, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ReverseElement16(firstOp[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ReverseElement16)}<Int32>(Vector128<Int32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ReverseElement16_Vector128_Int32() { var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int32> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 testClass) { var result = AdvSimd.ReverseElement16(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__ReverseElement16_Vector128_Int32 testClass) { fixed (Vector128<Int32>* pFld1 = &_fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Vector128<Int32> _clsVar1; private Vector128<Int32> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__ReverseElement16_Vector128_Int32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public SimpleUnaryOpTest__ReverseElement16_Vector128_Int32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ReverseElement16( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ReverseElement16), new Type[] { typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ReverseElement16), new Type[] { typeof(Vector128<Int32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ReverseElement16( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int32>* pClsVar1 = &_clsVar1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr); var result = AdvSimd.ReverseElement16(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr)); var result = AdvSimd.ReverseElement16(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); var result = AdvSimd.ReverseElement16(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__ReverseElement16_Vector128_Int32(); fixed (Vector128<Int32>* pFld1 = &test._fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ReverseElement16(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int32>* pFld1 = &_fld1) { var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.ReverseElement16(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.ReverseElement16( AdvSimd.LoadVector128((Int32*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int32> op1, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ReverseElement16(firstOp[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ReverseElement16)}<Int32>(Vector128<Int32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/MultiplyBySelectedScalarWideningUpperAndSubtract.Vector128.UInt16.Vector128.UInt16.7.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt16[] inArray2, UInt16[] inArray3, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<UInt16, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt16> _fld2; public Vector128<UInt16> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 testClass) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(_fld1, _fld2, _fld3, 7); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) fixed (Vector128<UInt16>* pFld3 = &_fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly byte Imm = 7; private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static UInt16[] _data3 = new UInt16[Op3ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt16> _clsVar2; private static Vector128<UInt16> _clsVar3; private Vector128<UInt32> _fld1; private Vector128<UInt16> _fld2; private Vector128<UInt16> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, _data3, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>), typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr), (byte)7 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>), typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)), (byte)7 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( _clsVar1, _clsVar2, _clsVar3, 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt16>* pClsVar2 = &_clsVar2) fixed (Vector128<UInt16>* pClsVar3 = &_clsVar3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt16*)(pClsVar2)), AdvSimd.LoadVector128((UInt16*)(pClsVar3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(op1, op2, op3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)); var op3 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(op1, op2, op3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(test._fld1, test._fld2, test._fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt16>* pFld2 = &test._fld2) fixed (Vector128<UInt16>* pFld3 = &test._fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(_fld1, _fld2, _fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) fixed (Vector128<UInt16>* pFld3 = &_fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(test._fld1, test._fld2, test._fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt16*)(&test._fld2)), AdvSimd.LoadVector128((UInt16*)(&test._fld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt16> op2, Vector128<UInt16> op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt16[] inArray3 = new UInt16[Op3ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt16[] inArray3 = new UInt16[Op3ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt16[] secondOp, UInt16[] thirdOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.MultiplyByScalarWideningUpperAndSubtract(firstOp, secondOp, thirdOp[Imm], i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract)}<UInt32>(Vector128<UInt32>, Vector128<UInt16>, Vector128<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt16[] inArray2, UInt16[] inArray3, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<UInt16, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt16> _fld2; public Vector128<UInt16> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 testClass) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(_fld1, _fld2, _fld3, 7); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) fixed (Vector128<UInt16>* pFld3 = &_fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly byte Imm = 7; private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static UInt16[] _data3 = new UInt16[Op3ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt16> _clsVar2; private static Vector128<UInt16> _clsVar3; private Vector128<UInt32> _fld1; private Vector128<UInt16> _fld2; private Vector128<UInt16> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld3), ref Unsafe.As<UInt16, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, _data3, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>), typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr), (byte)7 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>), typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)), (byte)7 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( _clsVar1, _clsVar2, _clsVar3, 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt16>* pClsVar2 = &_clsVar2) fixed (Vector128<UInt16>* pClsVar3 = &_clsVar3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt16*)(pClsVar2)), AdvSimd.LoadVector128((UInt16*)(pClsVar3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray3Ptr); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(op1, op2, op3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)); var op3 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray3Ptr)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(op1, op2, op3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(test._fld1, test._fld2, test._fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__MultiplyBySelectedScalarWideningUpperAndSubtract_Vector128_UInt16_Vector128_UInt16_7(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt16>* pFld2 = &test._fld2) fixed (Vector128<UInt16>* pFld3 = &test._fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(_fld1, _fld2, _fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) fixed (Vector128<UInt16>* pFld3 = &_fld3) { var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)), AdvSimd.LoadVector128((UInt16*)(pFld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract(test._fld1, test._fld2, test._fld3, 7); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt16*)(&test._fld2)), AdvSimd.LoadVector128((UInt16*)(&test._fld3)), 7 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt16> op2, Vector128<UInt16> op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt16[] inArray3 = new UInt16[Op3ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt16[] inArray3 = new UInt16[Op3ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt16[] secondOp, UInt16[] thirdOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.MultiplyByScalarWideningUpperAndSubtract(firstOp, secondOp, thirdOp[Imm], i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.MultiplyBySelectedScalarWideningUpperAndSubtract)}<UInt32>(Vector128<UInt32>, Vector128<UInt16>, Vector128<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/EccTestBase.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Security.Cryptography.Tests; using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.Tests { /// <summary> /// Input and helper methods for EC classes /// </summary> public abstract class EccTestBase { #if NETCOREAPP internal const string ECDSA_P224_OID_VALUE = "1.3.132.0.33"; // Also called nistP224 or secP224r1 internal const string ECDSA_P256_OID_VALUE = "1.2.840.10045.3.1.7"; // Also called nistP256, secP256r1 or prime256v1(OpenSsl) internal const string ECDSA_P384_OID_VALUE = "1.3.132.0.34"; // Also called nistP384 or secP384r1 internal const string ECDSA_P521_OID_VALUE = "1.3.132.0.35"; // Also called nistP521 or secP521r1 internal const string ECDSA_Sect193r1_OID_VALUE = "1.3.132.0.24"; //Char-2 curve public static IEnumerable<object[]> TestCurvesFull { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true select curveDef; foreach (CurveDef cd in curveDefs) yield return new[] { cd }; // return again with IncludePrivate = true foreach (CurveDef cd in curveDefs) { cd.IncludePrivate = true; yield return new[] { cd }; } } } public static IEnumerable<object[]> TestCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } public static IEnumerable<object[]> TestInvalidCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == false select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } public static IEnumerable<object[]> TestNewCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true && curveDef.RequiredOnPlatform == false select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } private static IEnumerable<CurveDef> TestCurvesRaw { get { // nistP* curves yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP256, // also secp256r1 KeySize = 256, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP384, // also secp384r1 KeySize = 384, CurveType = ECCurve.ECCurveType.PrimeMontgomery, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP521, // also secp521r1 KeySize = 521, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.brainpoolP160r1, KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.24", "")), // sect193r1 KeySize = 193, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.2.840.10045.3.0.1", "")), // c2pnb163v1 KeySize = 163, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.16", "")), // sect283k1 KeySize = 283, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.17", "")), // sect283r1 KeySize = 283, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("", "wap-wsg-idm-ecid-wtls7")), KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeMontgomery, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("invalid", "invalid")), KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, }; yield return new CurveDef { Curve = EccTestData.GetNistP256ExplicitCurve(), KeySize = 256, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, DisplayName = "NIST P-256", }; } } internal static void AssertEqual(in ECParameters p1, in ECParameters p2) { ComparePrivateKey(p1, p2); ComparePublicKey(p1.Q, p2.Q); CompareCurve(p1.Curve, p2.Curve); } internal static void ComparePrivateKey(in ECParameters p1, in ECParameters p2, bool isEqual = true) { if (isEqual) { Assert.Equal(p1.D, p2.D); } else { Assert.NotEqual(p1.D, p2.D); } } internal static void ComparePublicKey(in ECPoint q1, in ECPoint q2, bool isEqual = true) { if (isEqual) { Assert.Equal(q1.X, q2.X); Assert.Equal(q1.Y, q2.Y); } else { Assert.NotEqual(q1.X, q2.X); Assert.NotEqual(q1.Y, q2.Y); } } internal static void CompareCurve(in ECCurve c1, in ECCurve c2) { if (c1.IsNamed) { Assert.True(c2.IsNamed); if (OperatingSystem.IsWindows() || string.IsNullOrEmpty(c1.Oid.Value)) { Assert.Equal(c1.Oid.FriendlyName, c2.Oid.FriendlyName); } else { Assert.Equal(c1.Oid.Value, c2.Oid.Value); } } else if (c1.IsExplicit) { Assert.True(c2.IsExplicit); Assert.Equal(c1.A, c2.A); Assert.Equal(c1.B, c2.B); Assert.Equal(c1.CurveType, c2.CurveType); Assert.Equal(c1.G.X, c2.G.X); Assert.Equal(c1.G.Y, c2.G.Y); Assert.Equal(c1.Cofactor, c2.Cofactor); Assert.Equal(c1.Order, c2.Order); // Optional parameters. Null is an OK interpretation. // Different is not. if (c1.Seed != null && c2.Seed != null) { Assert.Equal(c1.Seed, c2.Seed); } if (c1.Hash != null && c2.Hash != null) { Assert.Equal(c1.Hash, c2.Hash); } if (c1.IsPrime) { Assert.True(c2.IsPrime); Assert.Equal(c1.Prime, c2.Prime); } else if (c1.IsCharacteristic2) { Assert.True(c2.IsCharacteristic2); Assert.Equal(c1.Polynomial, c2.Polynomial); } } } #endif } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Security.Cryptography.Tests; using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.Tests { /// <summary> /// Input and helper methods for EC classes /// </summary> public abstract class EccTestBase { #if NETCOREAPP internal const string ECDSA_P224_OID_VALUE = "1.3.132.0.33"; // Also called nistP224 or secP224r1 internal const string ECDSA_P256_OID_VALUE = "1.2.840.10045.3.1.7"; // Also called nistP256, secP256r1 or prime256v1(OpenSsl) internal const string ECDSA_P384_OID_VALUE = "1.3.132.0.34"; // Also called nistP384 or secP384r1 internal const string ECDSA_P521_OID_VALUE = "1.3.132.0.35"; // Also called nistP521 or secP521r1 internal const string ECDSA_Sect193r1_OID_VALUE = "1.3.132.0.24"; //Char-2 curve public static IEnumerable<object[]> TestCurvesFull { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true select curveDef; foreach (CurveDef cd in curveDefs) yield return new[] { cd }; // return again with IncludePrivate = true foreach (CurveDef cd in curveDefs) { cd.IncludePrivate = true; yield return new[] { cd }; } } } public static IEnumerable<object[]> TestCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } public static IEnumerable<object[]> TestInvalidCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == false select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } public static IEnumerable<object[]> TestNewCurves { get { var curveDefs = from curveDef in TestCurvesRaw where curveDef.IsCurveValidOnPlatform == true && curveDef.RequiredOnPlatform == false select curveDef; foreach (CurveDef curveDef in curveDefs) yield return new[] { curveDef }; } } private static IEnumerable<CurveDef> TestCurvesRaw { get { // nistP* curves yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP256, // also secp256r1 KeySize = 256, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP384, // also secp384r1 KeySize = 384, CurveType = ECCurve.ECCurveType.PrimeMontgomery, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.nistP521, // also secp521r1 KeySize = 521, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, RequiredOnPlatform = true, }; yield return new CurveDef() { Curve = ECCurve.NamedCurves.brainpoolP160r1, KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.24", "")), // sect193r1 KeySize = 193, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.2.840.10045.3.0.1", "")), // c2pnb163v1 KeySize = 163, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.16", "")), // sect283k1 KeySize = 283, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("1.3.132.0.17", "")), // sect283r1 KeySize = 283, CurveType = ECCurve.ECCurveType.Characteristic2, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("", "wap-wsg-idm-ecid-wtls7")), KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeMontgomery, }; yield return new CurveDef() { Curve = ECCurve.CreateFromOid(new Oid("invalid", "invalid")), KeySize = 160, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, }; yield return new CurveDef { Curve = EccTestData.GetNistP256ExplicitCurve(), KeySize = 256, CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, DisplayName = "NIST P-256", }; } } internal static void AssertEqual(in ECParameters p1, in ECParameters p2) { ComparePrivateKey(p1, p2); ComparePublicKey(p1.Q, p2.Q); CompareCurve(p1.Curve, p2.Curve); } internal static void ComparePrivateKey(in ECParameters p1, in ECParameters p2, bool isEqual = true) { if (isEqual) { Assert.Equal(p1.D, p2.D); } else { Assert.NotEqual(p1.D, p2.D); } } internal static void ComparePublicKey(in ECPoint q1, in ECPoint q2, bool isEqual = true) { if (isEqual) { Assert.Equal(q1.X, q2.X); Assert.Equal(q1.Y, q2.Y); } else { Assert.NotEqual(q1.X, q2.X); Assert.NotEqual(q1.Y, q2.Y); } } internal static void CompareCurve(in ECCurve c1, in ECCurve c2) { if (c1.IsNamed) { Assert.True(c2.IsNamed); if (OperatingSystem.IsWindows() || string.IsNullOrEmpty(c1.Oid.Value)) { Assert.Equal(c1.Oid.FriendlyName, c2.Oid.FriendlyName); } else { Assert.Equal(c1.Oid.Value, c2.Oid.Value); } } else if (c1.IsExplicit) { Assert.True(c2.IsExplicit); Assert.Equal(c1.A, c2.A); Assert.Equal(c1.B, c2.B); Assert.Equal(c1.CurveType, c2.CurveType); Assert.Equal(c1.G.X, c2.G.X); Assert.Equal(c1.G.Y, c2.G.Y); Assert.Equal(c1.Cofactor, c2.Cofactor); Assert.Equal(c1.Order, c2.Order); // Optional parameters. Null is an OK interpretation. // Different is not. if (c1.Seed != null && c2.Seed != null) { Assert.Equal(c1.Seed, c2.Seed); } if (c1.Hash != null && c2.Hash != null) { Assert.Equal(c1.Hash, c2.Hash); } if (c1.IsPrime) { Assert.True(c2.IsPrime); Assert.Equal(c1.Prime, c2.Prime); } else if (c1.IsCharacteristic2) { Assert.True(c2.IsCharacteristic2); Assert.Equal(c1.Polynomial, c2.Polynomial); } } } #endif } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/HostEnvironmentEnvExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; namespace Microsoft.Extensions.Hosting { /// <summary> /// Extension methods for <see cref="IHostEnvironment"/>. /// </summary> public static class HostEnvironmentEnvExtensions { /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Development"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Development"/>, otherwise false.</returns> public static bool IsDevelopment(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Development); } /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Staging"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Staging"/>, otherwise false.</returns> public static bool IsStaging(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Staging); } /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Production"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Production"/>, otherwise false.</returns> public static bool IsProduction(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Production); } /// <summary> /// Compares the current host environment name against the specified value. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <param name="environmentName">Environment name to validate against.</param> /// <returns>True if the specified name is the same as the current environment, otherwise false.</returns> public static bool IsEnvironment( this IHostEnvironment hostEnvironment, string environmentName) { ThrowHelper.ThrowIfNull(hostEnvironment); return string.Equals( hostEnvironment.EnvironmentName, environmentName, StringComparison.OrdinalIgnoreCase); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; namespace Microsoft.Extensions.Hosting { /// <summary> /// Extension methods for <see cref="IHostEnvironment"/>. /// </summary> public static class HostEnvironmentEnvExtensions { /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Development"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Development"/>, otherwise false.</returns> public static bool IsDevelopment(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Development); } /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Staging"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Staging"/>, otherwise false.</returns> public static bool IsStaging(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Staging); } /// <summary> /// Checks if the current host environment name is <see cref="EnvironmentName.Production"/>. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <returns>True if the environment name is <see cref="EnvironmentName.Production"/>, otherwise false.</returns> public static bool IsProduction(this IHostEnvironment hostEnvironment) { ThrowHelper.ThrowIfNull(hostEnvironment); return hostEnvironment.IsEnvironment(Environments.Production); } /// <summary> /// Compares the current host environment name against the specified value. /// </summary> /// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> /// <param name="environmentName">Environment name to validate against.</param> /// <returns>True if the specified name is the same as the current environment, otherwise false.</returns> public static bool IsEnvironment( this IHostEnvironment hostEnvironment, string environmentName) { ThrowHelper.ThrowIfNull(hostEnvironment); return string.Equals( hostEnvironment.EnvironmentName, environmentName, StringComparison.OrdinalIgnoreCase); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void AbsUInt16() { var test = new SimpleUnaryOpTest__AbsUInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__AbsUInt16 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int16[] inArray1, UInt16[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt16>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int16> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref testStruct._fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__AbsUInt16 testClass) { var result = Ssse3.Abs(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__AbsUInt16 testClass) { fixed (Vector128<Int16>* pFld1 = &_fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static Int16[] _data1 = new Int16[Op1ElementCount]; private static Vector128<Int16> _clsVar1; private Vector128<Int16> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__AbsUInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); } public SimpleUnaryOpTest__AbsUInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, new UInt16[RetElementCount], LargestVectorSize); } public bool IsSupported => Ssse3.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Ssse3.Abs( Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Ssse3.Abs( Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Ssse3.Abs( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int16>* pClsVar1 = &_clsVar1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__AbsUInt16(); var result = Ssse3.Abs(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__AbsUInt16(); fixed (Vector128<Int16>* pFld1 = &test._fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Ssse3.Abs(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int16>* pFld1 = &_fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Ssse3.Abs(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int16> op1, void* result, [CallerMemberName] string method = "") { Int16[] inArray1 = new Int16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Int16[] inArray1 = new Int16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Int16[] firstOp, UInt16[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != Math.Abs(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != Math.Abs(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Ssse3)}.{nameof(Ssse3.Abs)}<UInt16>(Vector128<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void AbsUInt16() { var test = new SimpleUnaryOpTest__AbsUInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__AbsUInt16 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int16[] inArray1, UInt16[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt16>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int16> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref testStruct._fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__AbsUInt16 testClass) { var result = Ssse3.Abs(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__AbsUInt16 testClass) { fixed (Vector128<Int16>* pFld1 = &_fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static Int16[] _data1 = new Int16[Op1ElementCount]; private static Vector128<Int16> _clsVar1; private Vector128<Int16> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__AbsUInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); } public SimpleUnaryOpTest__AbsUInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, new UInt16[RetElementCount], LargestVectorSize); } public bool IsSupported => Ssse3.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Ssse3.Abs( Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Ssse3.Abs( Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Ssse3).GetMethod(nameof(Ssse3.Abs), new Type[] { typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Ssse3.Abs( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int16>* pClsVar1 = &_clsVar1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int16>>(_dataTable.inArray1Ptr); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Int16*)(_dataTable.inArray1Ptr)); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArray1Ptr)); var result = Ssse3.Abs(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__AbsUInt16(); var result = Ssse3.Abs(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__AbsUInt16(); fixed (Vector128<Int16>* pFld1 = &test._fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Ssse3.Abs(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int16>* pFld1 = &_fld1) { var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Ssse3.Abs(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Ssse3.Abs( Sse2.LoadVector128((Int16*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int16> op1, void* result, [CallerMemberName] string method = "") { Int16[] inArray1 = new Int16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Int16[] inArray1 = new Int16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Int16[] firstOp, UInt16[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != Math.Abs(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != Math.Abs(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Ssse3)}.{nameof(Ssse3.Abs)}<UInt16>(Vector128<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IDesignerHost.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.ComponentModel.Design { /// <summary> /// Provides methods to adjust the configuration of and retrieve /// information about the services and behavior of a designer. /// </summary> public interface IDesignerHost : IServiceContainer { /// <summary> /// Gets or sets a value indicating whether the designer host /// is currently loading the document. /// </summary> bool Loading { get; } /// <summary> /// Gets a value indicating whether the designer host is currently in a transaction. /// </summary> bool InTransaction { get; } /// <summary> /// Gets the container for this designer host. /// </summary> IContainer Container { get; } /// <summary> /// Gets the instance of the base class used as the base class for the current design. /// </summary> IComponent RootComponent { get; } /// <summary> /// Gets the fully qualified name of the class that is being designed. /// </summary> string RootComponentClassName { get; } /// <summary> /// Gets the description of the current transaction. /// </summary> string TransactionDescription { get; } /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.Activated'/> event. /// </summary> event EventHandler Activated; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.Deactivated'/> event. /// </summary> event EventHandler Deactivated; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.LoadComplete'/> event. /// </summary> event EventHandler LoadComplete; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionClosed'/> event. /// </summary> event DesignerTransactionCloseEventHandler TransactionClosed; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionClosing'/> event. /// </summary> event DesignerTransactionCloseEventHandler TransactionClosing; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionOpened'/> event. /// </summary> event EventHandler TransactionOpened; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionOpening'/> event. /// </summary> event EventHandler TransactionOpening; /// <summary> /// Activates the designer that this host is hosting. /// </summary> void Activate(); /// <summary> /// Creates a component of the specified class type. /// </summary> IComponent CreateComponent(Type componentClass); /// <summary> /// Creates a component of the given class type and name and places it into the designer container. /// </summary> IComponent CreateComponent(Type componentClass, string name); /// <summary> /// Lengthy operations that involve multiple components may raise many events. These events /// may cause other side-effects, such as flicker or performance degradation. When operating /// on multiple components at one time, or setting multiple properties on a single component, /// you should encompass these changes inside a transaction. Transactions are used /// to improve performance and reduce flicker. Slow operations can listen to /// transaction events and only do work when the transaction completes. /// </summary> DesignerTransaction CreateTransaction(); /// <summary> /// Lengthy operations that involve multiple components may raise many events. These events /// may cause other side-effects, such as flicker or performance degradation. When operating /// on multiple components at one time, or setting multiple properties on a single component, /// you should encompass these changes inside a transaction. Transactions are used /// to improve performance and reduce flicker. Slow operations can listen to /// transaction events and only do work when the transaction completes. /// </summary> DesignerTransaction CreateTransaction(string description); /// <summary> /// Destroys the given component, removing it from the design container. /// </summary> void DestroyComponent(IComponent component); /// <summary> /// Gets the designer instance for the specified component. /// </summary> IDesigner? GetDesigner(IComponent component); /// <summary> /// Gets the type instance for the specified fully qualified type name <paramref name="typeName"/>. /// </summary> Type? GetType(string typeName); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.ComponentModel.Design { /// <summary> /// Provides methods to adjust the configuration of and retrieve /// information about the services and behavior of a designer. /// </summary> public interface IDesignerHost : IServiceContainer { /// <summary> /// Gets or sets a value indicating whether the designer host /// is currently loading the document. /// </summary> bool Loading { get; } /// <summary> /// Gets a value indicating whether the designer host is currently in a transaction. /// </summary> bool InTransaction { get; } /// <summary> /// Gets the container for this designer host. /// </summary> IContainer Container { get; } /// <summary> /// Gets the instance of the base class used as the base class for the current design. /// </summary> IComponent RootComponent { get; } /// <summary> /// Gets the fully qualified name of the class that is being designed. /// </summary> string RootComponentClassName { get; } /// <summary> /// Gets the description of the current transaction. /// </summary> string TransactionDescription { get; } /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.Activated'/> event. /// </summary> event EventHandler Activated; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.Deactivated'/> event. /// </summary> event EventHandler Deactivated; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.LoadComplete'/> event. /// </summary> event EventHandler LoadComplete; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionClosed'/> event. /// </summary> event DesignerTransactionCloseEventHandler TransactionClosed; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionClosing'/> event. /// </summary> event DesignerTransactionCloseEventHandler TransactionClosing; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionOpened'/> event. /// </summary> event EventHandler TransactionOpened; /// <summary> /// Adds an event handler for the <see cref='System.ComponentModel.Design.IDesignerHost.TransactionOpening'/> event. /// </summary> event EventHandler TransactionOpening; /// <summary> /// Activates the designer that this host is hosting. /// </summary> void Activate(); /// <summary> /// Creates a component of the specified class type. /// </summary> IComponent CreateComponent(Type componentClass); /// <summary> /// Creates a component of the given class type and name and places it into the designer container. /// </summary> IComponent CreateComponent(Type componentClass, string name); /// <summary> /// Lengthy operations that involve multiple components may raise many events. These events /// may cause other side-effects, such as flicker or performance degradation. When operating /// on multiple components at one time, or setting multiple properties on a single component, /// you should encompass these changes inside a transaction. Transactions are used /// to improve performance and reduce flicker. Slow operations can listen to /// transaction events and only do work when the transaction completes. /// </summary> DesignerTransaction CreateTransaction(); /// <summary> /// Lengthy operations that involve multiple components may raise many events. These events /// may cause other side-effects, such as flicker or performance degradation. When operating /// on multiple components at one time, or setting multiple properties on a single component, /// you should encompass these changes inside a transaction. Transactions are used /// to improve performance and reduce flicker. Slow operations can listen to /// transaction events and only do work when the transaction completes. /// </summary> DesignerTransaction CreateTransaction(string description); /// <summary> /// Destroys the given component, removing it from the design container. /// </summary> void DestroyComponent(IComponent component); /// <summary> /// Gets the designer instance for the specified component. /// </summary> IDesigner? GetDesigner(IComponent component); /// <summary> /// Gets the type instance for the specified fully qualified type name <paramref name="typeName"/>. /// </summary> Type? GetType(string typeName); } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest454/Generated454.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated454 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public sequential sealed MyStruct504`2<T0, T1> extends [mscorlib]System.ValueType implements class IBase2`2<class BaseClass1,class BaseClass1>, class IBase2`2<!T0,class BaseClass0> { .pack 0 .size 1 .method public hidebysig newslot virtual instance string Method7<M0>() cil managed noinlining { ldstr "MyStruct504::Method7.3922<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,class BaseClass1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<[1]>() ldstr "MyStruct504::Method7.MI.3923<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<T0,class BaseClass0>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<!T0,class BaseClass0>::Method7<[1]>() ldstr "MyStruct504::Method7.MI.3925<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot instance string ClassMethod997<M0>() cil managed noinlining { ldstr "MyStruct504::ClassMethod997.3926<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance bool Equals(object obj) cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance int32 GetHashCode() cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance string ToString() cil managed { ldstr "" ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated454 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.T.T<T0,T1,(valuetype MyStruct504`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.T.T<T0,T1,(valuetype MyStruct504`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<!!T0,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<!!T0,!!T1> callvirt instance string class IBase2`2<!!T0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.T<T1,(valuetype MyStruct504`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.T<T1,(valuetype MyStruct504`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.A<(valuetype MyStruct504`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.A<(valuetype MyStruct504`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.B<(valuetype MyStruct504`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.B<(valuetype MyStruct504`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.T<T1,(valuetype MyStruct504`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.T<T1,(valuetype MyStruct504`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.A<(valuetype MyStruct504`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.A<(valuetype MyStruct504`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.B<(valuetype MyStruct504`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.B<(valuetype MyStruct504`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_1) ldloca V_1 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloca V_1 dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ToString() pop pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_2) ldloca V_2 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloca V_2 dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ToString() pop pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_3) ldloca V_3 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloca V_3 dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ToString() pop pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_4) ldloca V_4 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloca V_4 dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ToString() pop pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_5) ldloca V_5 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_6) ldloca V_6 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV12 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV12} LV12: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV13 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV13} LV13: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV14 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV14} LV14: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV15 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV15} LV15: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV16 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV16} LV16: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV17 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV17} LV17: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_7) ldloca V_7 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV18 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV18} LV18: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV19 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV19} LV19: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV20 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV20} LV20: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV21 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV21} LV21: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV22 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV22} LV22: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV23 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV23} LV23: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV24 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV24} LV24: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV25 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV25} LV25: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV26 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV26} LV26: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV27 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV27} LV27: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV28 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV28} LV28: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV29 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV29} LV29: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_8) ldloca V_8 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV30 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV30} LV30: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV31 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV31} LV31: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV32 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV32} LV32: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV33 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV33} LV33: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV34 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV34} LV34: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV35 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV35} LV35: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV36 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV36} LV36: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV37 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV37} LV37: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV38 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV38} LV38: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV39 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV39} LV39: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV40 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV40} LV40: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV41 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV41} LV41: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_9) ldloca V_9 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_10) ldloca V_10 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_11) ldloca V_11 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_12) ldloca V_12 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_13) ldloca V_13 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldnull ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ToString() calli default string(object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_14) ldloca V_14 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldnull ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ToString() calli default string(object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_15) ldloca V_15 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldnull ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ToString() calli default string(object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_16) ldloca V_16 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldnull ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ToString() calli default string(object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated454::MethodCallingTest() call void Generated454::ConstrainedCallsTest() call void Generated454::StructConstrainedInterfaceCallsTest() call void Generated454::CalliTest() ldc.i4 100 ret } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated454 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public sequential sealed MyStruct504`2<T0, T1> extends [mscorlib]System.ValueType implements class IBase2`2<class BaseClass1,class BaseClass1>, class IBase2`2<!T0,class BaseClass0> { .pack 0 .size 1 .method public hidebysig newslot virtual instance string Method7<M0>() cil managed noinlining { ldstr "MyStruct504::Method7.3922<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,class BaseClass1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<[1]>() ldstr "MyStruct504::Method7.MI.3923<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<T0,class BaseClass0>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<!T0,class BaseClass0>::Method7<[1]>() ldstr "MyStruct504::Method7.MI.3925<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot instance string ClassMethod997<M0>() cil managed noinlining { ldstr "MyStruct504::ClassMethod997.3926<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance bool Equals(object obj) cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance int32 GetHashCode() cil managed { ldc.i4.0 ret } .method public hidebysig virtual instance string ToString() cil managed { ldstr "" ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated454 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.T.T<T0,T1,(valuetype MyStruct504`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.T.T<T0,T1,(valuetype MyStruct504`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<!!T0,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<!!T0,!!T1> callvirt instance string class IBase2`2<!!T0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.T<T1,(valuetype MyStruct504`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.T<T1,(valuetype MyStruct504`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,!!T1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.A<(valuetype MyStruct504`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.A<(valuetype MyStruct504`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.A.B<(valuetype MyStruct504`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.A.B<(valuetype MyStruct504`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass0,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.T<T1,(valuetype MyStruct504`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.T<T1,(valuetype MyStruct504`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,!!T1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.A<(valuetype MyStruct504`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.A<(valuetype MyStruct504`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass0> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.MyStruct504.B.B<(valuetype MyStruct504`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 7 .locals init (string[] actualResults) ldc.i4.s 2 newarr string stloc.s actualResults ldarg.1 ldstr "M.MyStruct504.B.B<(valuetype MyStruct504`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 2 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. valuetype MyStruct504`2<class BaseClass1,class BaseClass1> callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_1) ldloca V_1 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloca V_1 dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ToString() pop pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_1 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_2) ldloca V_2 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloca V_2 dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ToString() pop pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_2 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_3) ldloca V_3 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloca V_3 dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ToString() pop pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_3 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_4) ldloca V_4 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloca V_4 dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ClassMethod997<object>() ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type MyStruct504" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup ldnull call instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Equals(object) pop dup call instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::GetHashCode() pop dup call instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ToString() pop pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc V_4 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_5) ldloca V_5 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_5 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_6) ldloca V_6 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV12 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV12} LV12: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV13 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV13} LV13: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV14 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV14} LV14: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV15 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV15} LV15: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV16 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV16} LV16: .try { ldloc V_6 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV17 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV17} LV17: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_7) ldloca V_7 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV18 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV18} LV18: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV19 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV19} LV19: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV20 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV20} LV20: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV21 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV21} LV21: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV22 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV22} LV22: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV23 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV23} LV23: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV24 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV24} LV24: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV25 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV25} LV25: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV26 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV26} LV26: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV27 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV27} LV27: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV28 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV28} LV28: .try { ldloc V_7 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV29 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV29} LV29: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_8) ldloca V_8 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV30 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV30} LV30: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV31 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV31} LV31: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV32 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV32} LV32: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV33 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV33} LV33: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV34 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV34} LV34: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV35 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV35} LV35: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV36 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV36} LV36: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV37 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV37} LV37: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" call void Generated454::M.IBase2.A.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV38 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV38} LV38: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV39 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV39} LV39: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV40 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV40} LV40: .try { ldloc V_8 ldstr "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.IBase2.A.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV41 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV41} LV41: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_9) ldloca V_9 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass0,class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!2,string) leave.s LV0 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV0} LV0: .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!1,string) leave.s LV1 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV1} LV1: .try { ldloc V_9 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.A<valuetype MyStruct504`2<class BaseClass0,class BaseClass0>>(!!0,string) leave.s LV2 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV2} LV2: .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_10) ldloca V_10 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass0,class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!2,string) leave.s LV3 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV3} LV3: .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!1,string) leave.s LV4 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV4} LV4: .try { ldloc V_10 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.A.B<valuetype MyStruct504`2<class BaseClass0,class BaseClass1>>(!!0,string) leave.s LV5 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV5} LV5: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_11) ldloca V_11 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass1,class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!2,string) leave.s LV6 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV6} LV6: .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.T<class BaseClass0,valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!1,string) leave.s LV7 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV7} LV7: .try { ldloc V_11 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.A<valuetype MyStruct504`2<class BaseClass1,class BaseClass0>>(!!0,string) leave.s LV8 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV8} LV8: .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_12) ldloca V_12 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.T.T<class BaseClass1,class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!2,string) leave.s LV9 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV9} LV9: .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.T<class BaseClass1,valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!1,string) leave.s LV10 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV10} LV10: .try { ldloc V_12 ldstr "MyStruct504::Method7.MI.3923<System.Object>()#" + "MyStruct504::Method7.MI.3925<System.Object>()#" call void Generated454::M.MyStruct504.B.B<valuetype MyStruct504`2<class BaseClass1,class BaseClass1>>(!!0,string) leave.s LV11 } catch [mscorlib]System.Security.VerificationException { pop leave.s LV11} LV11: ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass0> V_13) ldloca V_13 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldnull ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass0>::ToString() calli default string(object) pop ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldloc V_13 box valuetype MyStruct504`2<class BaseClass0,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass0,class BaseClass1> V_14) ldloca V_14 initobj valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldnull ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass0,class BaseClass1>::ToString() calli default string(object) pop ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldloc V_14 box valuetype MyStruct504`2<class BaseClass0,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass0> V_15) ldloca V_15 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldnull ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::Equals(object) calli default bool(object,object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::GetHashCode() calli default int32(object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass0>::ToString() calli default string(object) pop ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldloc V_15 box valuetype MyStruct504`2<class BaseClass1,class BaseClass0> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) .locals init (valuetype MyStruct504`2<class BaseClass1,class BaseClass1> V_16) ldloca V_16 initobj valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.3922<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ClassMethod997<object>() calli default string(object) ldstr "MyStruct504::ClassMethod997.3926<System.Object>()" ldstr "valuetype MyStruct504`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldnull ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance bool valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::Equals(object) calli default bool(object,object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance int32 valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::GetHashCode() calli default int32(object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string valuetype MyStruct504`2<class BaseClass1,class BaseClass1>::ToString() calli default string(object) pop ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3923<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldloc V_16 box valuetype MyStruct504`2<class BaseClass1,class BaseClass1> ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(object) ldstr "MyStruct504::Method7.MI.3925<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type valuetype MyStruct504`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated454::MethodCallingTest() call void Generated454::ConstrainedCallsTest() call void Generated454::StructConstrainedInterfaceCallsTest() call void Generated454::CalliTest() ldc.i4 100 ret } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/mono/mono/tests/verifier/make_type_constraint_test.sh
#! /bin/sh SED="sed" if [ `which gsed 2> /dev/null` ]; then SED="gsed" fi TEST_NAME=$1 TEST_VALIDITY=$2 TEST_INSTANTIATION=$3 TEST_CONSTRAINTS=$4 TEST_EXTRA_CODE=$5 TEST_NAME=${TEST_VALIDITY}_${TEST_NAME} TEST_FILE=${TEST_NAME}_generated.il echo $TEST_FILE $SED -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/INSTANTIATION/${TEST_INSTANTIATION}/g" -e "s/CONSTRAINTS/${TEST_CONSTRAINTS}/g" -e "s/EXTRA_CODE/${TEST_EXTRA_CODE}/g" > $TEST_FILE <<//EOF // VALIDITY CIL which breaks the ECMA-335 rules. // this CIL should fail verification by a conforming CLI verifier. .assembly '${TEST_NAME}_generated' { .hash algorithm 0x00008004 .ver 0:0:0:0 } .assembly extern mscorlib { .ver 1:0:5000:0 .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. } .class interface public auto ansi abstract IFace { .method public virtual hidebysig newslot abstract instance default void Tst () cil managed { } } .class public auto ansi beforefieldinit IFaceImpl extends [mscorlib]System.Object implements IFace { .method public hidebysig specialname rtspecialname instance default void '.ctor' () cil managed { .maxstack 8 ldarg.0 call instance void object::'.ctor'() ret } .method public final virtual hidebysig newslot instance default void Tst () cil managed { .maxstack 8 ret } } .class ClassNoDefaultCtor extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor (int32 d) cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class abstract AbstractClass extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class ClassWithDefaultCtorNotVisible extends [mscorlib]System.Object { .method private hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class ClassWithDefaultCtor extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class sealed MyValueType extends [mscorlib]System.ValueType { .field public int32 v } .class public auto ansi sealed MyEnum extends [mscorlib]System.Enum { .field public specialname rtspecialname int32 value__ .field public static literal valuetype MyEnum B = int32(0x00000000) .field public static literal valuetype MyEnum C = int32(0x00000001) } .class TemplateTarget<CONSTRAINTS T> extends [mscorlib]System.Object { .field !T t .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } .method public void DoStuff() cil managed { .maxstack 8 .locals init () ldtoken !T call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call void class [mscorlib]System.Console::WriteLine(object) EXTRA_CODE ret } } .class Driver extends [mscorlib]System.Object { .method public static void UseIFace (IFace arg0) { .maxstack 8 ret } .method public static void MemberMain() cil managed { .maxstack 8 .locals init () newobj instance void class TemplateTarget<INSTANTIATION>::.ctor() call instance void class TemplateTarget<INSTANTIATION>::DoStuff() ret } .method public static void Main() cil managed { .entrypoint .maxstack 8 .locals init () call void Driver::MemberMain() leave END END: ret } } //EOF
#! /bin/sh SED="sed" if [ `which gsed 2> /dev/null` ]; then SED="gsed" fi TEST_NAME=$1 TEST_VALIDITY=$2 TEST_INSTANTIATION=$3 TEST_CONSTRAINTS=$4 TEST_EXTRA_CODE=$5 TEST_NAME=${TEST_VALIDITY}_${TEST_NAME} TEST_FILE=${TEST_NAME}_generated.il echo $TEST_FILE $SED -e "s/VALIDITY/${TEST_VALIDITY}/g" -e "s/INSTANTIATION/${TEST_INSTANTIATION}/g" -e "s/CONSTRAINTS/${TEST_CONSTRAINTS}/g" -e "s/EXTRA_CODE/${TEST_EXTRA_CODE}/g" > $TEST_FILE <<//EOF // VALIDITY CIL which breaks the ECMA-335 rules. // this CIL should fail verification by a conforming CLI verifier. .assembly '${TEST_NAME}_generated' { .hash algorithm 0x00008004 .ver 0:0:0:0 } .assembly extern mscorlib { .ver 1:0:5000:0 .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. } .class interface public auto ansi abstract IFace { .method public virtual hidebysig newslot abstract instance default void Tst () cil managed { } } .class public auto ansi beforefieldinit IFaceImpl extends [mscorlib]System.Object implements IFace { .method public hidebysig specialname rtspecialname instance default void '.ctor' () cil managed { .maxstack 8 ldarg.0 call instance void object::'.ctor'() ret } .method public final virtual hidebysig newslot instance default void Tst () cil managed { .maxstack 8 ret } } .class ClassNoDefaultCtor extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor (int32 d) cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class abstract AbstractClass extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class ClassWithDefaultCtorNotVisible extends [mscorlib]System.Object { .method private hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class ClassWithDefaultCtor extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } } .class sealed MyValueType extends [mscorlib]System.ValueType { .field public int32 v } .class public auto ansi sealed MyEnum extends [mscorlib]System.Enum { .field public specialname rtspecialname int32 value__ .field public static literal valuetype MyEnum B = int32(0x00000000) .field public static literal valuetype MyEnum C = int32(0x00000001) } .class TemplateTarget<CONSTRAINTS T> extends [mscorlib]System.Object { .field !T t .method public hidebysig specialname rtspecialname instance default void .ctor () cil managed { .maxstack 8 ldarg.0 call instance void object::.ctor() ret } .method public void DoStuff() cil managed { .maxstack 8 .locals init () ldtoken !T call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call void class [mscorlib]System.Console::WriteLine(object) EXTRA_CODE ret } } .class Driver extends [mscorlib]System.Object { .method public static void UseIFace (IFace arg0) { .maxstack 8 ret } .method public static void MemberMain() cil managed { .maxstack 8 .locals init () newobj instance void class TemplateTarget<INSTANTIATION>::.ctor() call instance void class TemplateTarget<INSTANTIATION>::DoStuff() ret } .method public static void Main() cil managed { .entrypoint .maxstack 8 .locals init () call void Driver::MemberMain() leave END END: ret } } //EOF
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Private.Xml.Linq/tests/XDocument.Common/ManagedNodeWriter.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.IO; using System.Text; namespace CoreXml.Test.XLinq { public class ManagedNodeWriter { public static bool DEBUG = false; private const string XML_DECL = "<?xml version='1.0' ?>\n"; private const string S_ROOT = "<root>"; private const string E_ROOT = "</root>"; private const string E_NAME = "ELEMENT_"; private const string A_NAME = "ATTRIB_"; private const string A_VALUE = "VALUE_"; private const string CDATA = "CDATA_"; private const string TEXT = "TEXT_"; private const string PI = "PI_"; private const string COMMENT = "COMMENT_"; private long _eCount = 0; //element indexer private long _aCount = 0; //attribute indexer private long _cCount = 0; //Cdata indexer private long _tCount = 0; //Text indexer private long _pCount = 0; //PI Indexer private long _mCount = 0; //Comment Indexer private StreamWriter _textWriter = null; private Stack<string> _elementStack = new Stack<string>(); private StringBuilder _nodeQueue = new StringBuilder(); private const string LT = "<"; private const string GT = ">"; private const string MT = "/>"; private const string ET = "</"; private const string SPACE = " "; private const string S_QUOTE = "'"; private const string D_QUOTE = "\""; private const string EQ = "="; private const string LF = "\n"; public ManagedNodeWriter() { } public ManagedNodeWriter(Stream myStream, Encoding enc) { _textWriter = new StreamWriter(myStream, enc); } /// <summary> /// GetNodes returns the existing XML string thats been written so far. /// </summary> /// <returns>String of XML</returns> public string GetNodes() { return _nodeQueue.ToString(); } /// Closing the NodeWriter public void Close() { if (_textWriter != null) { _textWriter.Write(_nodeQueue.ToString()); _textWriter.Dispose(); _textWriter = null; } } /// Writing XML Decl public void PutDecl() { _nodeQueue.Append(XML_DECL); } /// Writing a Root Element. public void PutRoot() { _nodeQueue.Append(S_ROOT); } /// Writing End Root Element. public void PutEndRoot() { _nodeQueue.Append(E_ROOT); } /// Writing a start of open element. public void OpenElement() { string elem = LT + E_NAME + _eCount + SPACE; _nodeQueue.Append(elem); _elementStack.Push(E_NAME + _eCount); ++_eCount; } /// Writing a start of open element with user supplied name. public void OpenElement(string myName) { string elem = LT + myName + SPACE; _elementStack.Push(myName); _nodeQueue.Append(elem); } /// Closing the open element. public void CloseElement() { _nodeQueue.Append(GT); } // Closing the open element as empty element public void CloseEmptyElement() { _nodeQueue.Append(MT); } /// Writing an attribute. public void PutAttribute() { string attr = A_NAME + _aCount + EQ + S_QUOTE + A_VALUE + _aCount + S_QUOTE + SPACE; _nodeQueue.Append(attr); ++_aCount; } /// Overloaded PutAttribute which takes user values. public void PutAttribute(string myAttrName, string myAttrValue) { string attr = SPACE + myAttrName + EQ + S_QUOTE + myAttrValue + S_QUOTE; _nodeQueue.Append(attr); } /// Writing empty element. public void PutEmptyElement() { string elem = LT + E_NAME + _eCount + MT; _nodeQueue.Append(elem); ++_eCount; } /// Writing an end element from the stack. public void PutEndElement() { string elem = _elementStack.Pop(); _nodeQueue.Append(ET + elem + GT); } /// Writing an end element for a given name. public void PutEndElement(string myName) { if (DEBUG) { string elem = _elementStack.Pop(); } _nodeQueue.Append(ET + myName + GT); } /// <summary> /// Finish allows user to complete xml file with the end element tags that were so far open. /// </summary> public void Finish() { while (_elementStack.Count > 0) { string elem = _elementStack.Pop(); _nodeQueue.Append(ET + elem + GT); } } /// Writing text. /// Note : This is basically equivalent to WriteRaw and the string may contain any number of embedded tags. /// No checking is performed on them either. public void PutText(string myStr) { _nodeQueue.Append(myStr); } /// <summary> /// AutoGenerated Text /// </summary> public void PutText() { _nodeQueue.Append(TEXT + _tCount++); } /// <summary> /// Writing a Byte Array. /// </summary> /// <param name="bArr"></param> public void PutBytes(byte[] bArr) { foreach (byte b in bArr) { _nodeQueue.Append(b); } } public void PutByte() { _nodeQueue.Append(Convert.ToByte("a")); } /// <summary> /// Writes out CDATA Node. /// </summary> public void PutCData() { _nodeQueue.Append($"<![CDATA[{CDATA}{_cCount++}]]>"); } /// <summary> /// Writes out a PI Node. /// </summary> public void PutPI() { _nodeQueue.Append($"<?{PI}{_pCount++}?>"); } /// <summary> /// Writes out a Comment Node. /// </summary> public void PutComment() { _nodeQueue.Append($"<!--{COMMENT}{_mCount++} -->"); } /// <summary> /// Writes out a single whitespace /// </summary> public void PutWhiteSpace() { _nodeQueue.Append(" "); } /// <summary> /// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement, /// PutAttribute, PutAttribute and CloseElement for you. /// The following is the list of all allowed characters and their function mappings : /// ///'X' : PutDecl() ///'E' : OpenElement() ///'M' : CloseEmptyElement() ///'/' : CloseElement() ///'e' : PutEndElement() ///'A' : PutAttribute() ///'P' : PutPI() ///'T' : PutText() ///'C' : PutComment() ///'R' : PutRoot() ///'r' : PutEndRoot() ///'B' : PutEndRoot() ///'W' : PutWhiteSpace() /// /// </summary> /// <param name="pattern">String containing the pattern which you want to use to create /// the XML string. Refer to table above for supported chars.</param> public void PutPattern(string pattern) { char[] patternArr = pattern.ToCharArray(); foreach (char ch in patternArr) { switch (ch) { case 'X': PutDecl(); break; case 'E': OpenElement(); break; case 'M': CloseEmptyElement(); break; case '/': CloseElement(); break; case 'e': PutEndElement(); break; case 'A': PutAttribute(); break; case 'P': PutPI(); break; case 'T': PutText(); break; case 'C': PutComment(); break; case 'R': PutRoot(); break; case 'r': PutEndRoot(); break; case 'B': PutEndRoot(); break; case 'W': PutWhiteSpace(); break; default: break; } } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.IO; using System.Text; namespace CoreXml.Test.XLinq { public class ManagedNodeWriter { public static bool DEBUG = false; private const string XML_DECL = "<?xml version='1.0' ?>\n"; private const string S_ROOT = "<root>"; private const string E_ROOT = "</root>"; private const string E_NAME = "ELEMENT_"; private const string A_NAME = "ATTRIB_"; private const string A_VALUE = "VALUE_"; private const string CDATA = "CDATA_"; private const string TEXT = "TEXT_"; private const string PI = "PI_"; private const string COMMENT = "COMMENT_"; private long _eCount = 0; //element indexer private long _aCount = 0; //attribute indexer private long _cCount = 0; //Cdata indexer private long _tCount = 0; //Text indexer private long _pCount = 0; //PI Indexer private long _mCount = 0; //Comment Indexer private StreamWriter _textWriter = null; private Stack<string> _elementStack = new Stack<string>(); private StringBuilder _nodeQueue = new StringBuilder(); private const string LT = "<"; private const string GT = ">"; private const string MT = "/>"; private const string ET = "</"; private const string SPACE = " "; private const string S_QUOTE = "'"; private const string D_QUOTE = "\""; private const string EQ = "="; private const string LF = "\n"; public ManagedNodeWriter() { } public ManagedNodeWriter(Stream myStream, Encoding enc) { _textWriter = new StreamWriter(myStream, enc); } /// <summary> /// GetNodes returns the existing XML string thats been written so far. /// </summary> /// <returns>String of XML</returns> public string GetNodes() { return _nodeQueue.ToString(); } /// Closing the NodeWriter public void Close() { if (_textWriter != null) { _textWriter.Write(_nodeQueue.ToString()); _textWriter.Dispose(); _textWriter = null; } } /// Writing XML Decl public void PutDecl() { _nodeQueue.Append(XML_DECL); } /// Writing a Root Element. public void PutRoot() { _nodeQueue.Append(S_ROOT); } /// Writing End Root Element. public void PutEndRoot() { _nodeQueue.Append(E_ROOT); } /// Writing a start of open element. public void OpenElement() { string elem = LT + E_NAME + _eCount + SPACE; _nodeQueue.Append(elem); _elementStack.Push(E_NAME + _eCount); ++_eCount; } /// Writing a start of open element with user supplied name. public void OpenElement(string myName) { string elem = LT + myName + SPACE; _elementStack.Push(myName); _nodeQueue.Append(elem); } /// Closing the open element. public void CloseElement() { _nodeQueue.Append(GT); } // Closing the open element as empty element public void CloseEmptyElement() { _nodeQueue.Append(MT); } /// Writing an attribute. public void PutAttribute() { string attr = A_NAME + _aCount + EQ + S_QUOTE + A_VALUE + _aCount + S_QUOTE + SPACE; _nodeQueue.Append(attr); ++_aCount; } /// Overloaded PutAttribute which takes user values. public void PutAttribute(string myAttrName, string myAttrValue) { string attr = SPACE + myAttrName + EQ + S_QUOTE + myAttrValue + S_QUOTE; _nodeQueue.Append(attr); } /// Writing empty element. public void PutEmptyElement() { string elem = LT + E_NAME + _eCount + MT; _nodeQueue.Append(elem); ++_eCount; } /// Writing an end element from the stack. public void PutEndElement() { string elem = _elementStack.Pop(); _nodeQueue.Append(ET + elem + GT); } /// Writing an end element for a given name. public void PutEndElement(string myName) { if (DEBUG) { string elem = _elementStack.Pop(); } _nodeQueue.Append(ET + myName + GT); } /// <summary> /// Finish allows user to complete xml file with the end element tags that were so far open. /// </summary> public void Finish() { while (_elementStack.Count > 0) { string elem = _elementStack.Pop(); _nodeQueue.Append(ET + elem + GT); } } /// Writing text. /// Note : This is basically equivalent to WriteRaw and the string may contain any number of embedded tags. /// No checking is performed on them either. public void PutText(string myStr) { _nodeQueue.Append(myStr); } /// <summary> /// AutoGenerated Text /// </summary> public void PutText() { _nodeQueue.Append(TEXT + _tCount++); } /// <summary> /// Writing a Byte Array. /// </summary> /// <param name="bArr"></param> public void PutBytes(byte[] bArr) { foreach (byte b in bArr) { _nodeQueue.Append(b); } } public void PutByte() { _nodeQueue.Append(Convert.ToByte("a")); } /// <summary> /// Writes out CDATA Node. /// </summary> public void PutCData() { _nodeQueue.Append($"<![CDATA[{CDATA}{_cCount++}]]>"); } /// <summary> /// Writes out a PI Node. /// </summary> public void PutPI() { _nodeQueue.Append($"<?{PI}{_pCount++}?>"); } /// <summary> /// Writes out a Comment Node. /// </summary> public void PutComment() { _nodeQueue.Append($"<!--{COMMENT}{_mCount++} -->"); } /// <summary> /// Writes out a single whitespace /// </summary> public void PutWhiteSpace() { _nodeQueue.Append(" "); } /// <summary> /// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement, /// PutAttribute, PutAttribute and CloseElement for you. /// The following is the list of all allowed characters and their function mappings : /// ///'X' : PutDecl() ///'E' : OpenElement() ///'M' : CloseEmptyElement() ///'/' : CloseElement() ///'e' : PutEndElement() ///'A' : PutAttribute() ///'P' : PutPI() ///'T' : PutText() ///'C' : PutComment() ///'R' : PutRoot() ///'r' : PutEndRoot() ///'B' : PutEndRoot() ///'W' : PutWhiteSpace() /// /// </summary> /// <param name="pattern">String containing the pattern which you want to use to create /// the XML string. Refer to table above for supported chars.</param> public void PutPattern(string pattern) { char[] patternArr = pattern.ToCharArray(); foreach (char ch in patternArr) { switch (ch) { case 'X': PutDecl(); break; case 'E': OpenElement(); break; case 'M': CloseEmptyElement(); break; case '/': CloseElement(); break; case 'e': PutEndElement(); break; case 'A': PutAttribute(); break; case 'P': PutPI(); break; case 'T': PutText(); break; case 'C': PutComment(); break; case 'R': PutRoot(); break; case 'r': PutEndRoot(); break; case 'B': PutEndRoot(); break; case 'W': PutWhiteSpace(); break; default: break; } } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorOpenFile.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="CctorOpenFile.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="CctorOpenFile.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetFileAttributes.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { /// <summary> /// WARNING: This method does not implicitly handle long paths. Use SetFileAttributes. /// </summary> [LibraryImport(Libraries.Kernel32, EntryPoint = "SetFileAttributesW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool SetFileAttributesPrivate( string name, int attr); internal static bool SetFileAttributes(string name, int attr) { name = PathInternal.EnsureExtendedPrefixIfNeeded(name); return SetFileAttributesPrivate(name, attr); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { /// <summary> /// WARNING: This method does not implicitly handle long paths. Use SetFileAttributes. /// </summary> [LibraryImport(Libraries.Kernel32, EntryPoint = "SetFileAttributesW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool SetFileAttributesPrivate( string name, int attr); internal static bool SetFileAttributes(string name, int attr) { name = PathInternal.EnsureExtendedPrefixIfNeeded(name); return SetFileAttributesPrivate(name, attr); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Private.Uri/tests/FunctionalTests/IdnCheckHostNameTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Net; using System.Tests; using Xunit; namespace System.PrivateUri.Tests { public class IdnCheckHostNameTest { [Fact] public void IdnCheckHostName_Empty_Unknown() { Assert.Equal(UriHostNameType.Unknown, Uri.CheckHostName(string.Empty)); } [Fact] public void IdnCheckHostName_FlatDns_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("Host")); } [Fact] public void IdnCheckHostName_FqdnDns_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("Host.corp.micorosoft.com")); } [Fact] public void IdnCheckHostName_IPv4_IPv4() { Assert.Equal(UriHostNameType.IPv4, Uri.CheckHostName(IPAddress.Loopback.ToString())); } [Fact] public void IdnCheckHostName_IPv6WithoutBrackets_IPv6() { Assert.Equal(UriHostNameType.IPv6, Uri.CheckHostName(IPAddress.IPv6Loopback.ToString())); } [Fact] public void IdnCheckHostName_IPv6WithBrackets_IPv6() { Assert.Equal(UriHostNameType.IPv6, Uri.CheckHostName($"[{IPAddress.IPv6Loopback}]")); } [Fact] public void IdnCheckHostName_UnicodeIdnOffIriOn_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("nZMot\u00E1\u00D3\u0063vKi\u00CD.contoso.com")); using (var helper = new ThreadCultureChange("zh-cn")) { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("nZMot\u00E1\u00D3\u0063vKi\u00CD.contoso.com")); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Net; using System.Tests; using Xunit; namespace System.PrivateUri.Tests { public class IdnCheckHostNameTest { [Fact] public void IdnCheckHostName_Empty_Unknown() { Assert.Equal(UriHostNameType.Unknown, Uri.CheckHostName(string.Empty)); } [Fact] public void IdnCheckHostName_FlatDns_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("Host")); } [Fact] public void IdnCheckHostName_FqdnDns_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("Host.corp.micorosoft.com")); } [Fact] public void IdnCheckHostName_IPv4_IPv4() { Assert.Equal(UriHostNameType.IPv4, Uri.CheckHostName(IPAddress.Loopback.ToString())); } [Fact] public void IdnCheckHostName_IPv6WithoutBrackets_IPv6() { Assert.Equal(UriHostNameType.IPv6, Uri.CheckHostName(IPAddress.IPv6Loopback.ToString())); } [Fact] public void IdnCheckHostName_IPv6WithBrackets_IPv6() { Assert.Equal(UriHostNameType.IPv6, Uri.CheckHostName($"[{IPAddress.IPv6Loopback}]")); } [Fact] public void IdnCheckHostName_UnicodeIdnOffIriOn_Dns() { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("nZMot\u00E1\u00D3\u0063vKi\u00CD.contoso.com")); using (var helper = new ThreadCultureChange("zh-cn")) { Assert.Equal(UriHostNameType.Dns, Uri.CheckHostName("nZMot\u00E1\u00D3\u0063vKi\u00CD.contoso.com")); } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Directed/zeroinit/init_uint32.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { } .assembly extern xunit.core {} .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } .assembly init_uint32 { } .class private auto ansi beforefieldinit Test_init_uint32 extends [mscorlib]System.Object { .field private unsigned int32 m_ret .field private static class Test_init_uint32 global .method private hidebysig static unsigned int32 noinline1(unsigned int32 'ret') cil managed { .maxstack 1 ldarga.s 0 ldind.i4 ret } .method private hidebysig static unsigned int32 noinline2(unsigned int32& 'ret') cil managed { .maxstack 1 ldarga.s 0 ldind.i ldind.i4 ret } // end of method Test::noinline2 .method private hidebysig static unsigned int32 test1() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0006: ldloc.1 IL_0007: ret } // end of method Test::test1 .method private hidebysig static unsigned int32 test2() cil managed { // Code size 21 (0x15) .maxstack 3 .locals init (unsigned int32 V_0, unsigned int32 V_1, unsigned int32 V_2) IL_0004: ldloc.0 IL_0005: ldc.i4.1 IL_0006: shr IL_0007: ldc.i4.1 IL_0008: and IL_0009: ldloc.1 IL_000a: ldc.i4.2 IL_000b: shl IL_000c: sub IL_000d: ldc.i4.s 11 IL_000f: add IL_0010: stloc.2 IL_0011: br.s IL_0013 IL_0013: ldloc.2 IL_0014: ret } // end of method Test::test2 .method private hidebysig static unsigned int32 test3() cil managed { // Code size 13 (0xd) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0002: ldloc.0 IL_0003: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0008: stloc.1 IL_0009: br.s IL_000b IL_000b: ldloc.1 IL_000c: ret } // end of method Test::test3 .method private hidebysig static unsigned int32 test4() cil managed { // Code size 14 (0xe) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0002: ldloca.s V_0 IL_0004: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_0009: stloc.1 IL_000a: br.s IL_000c IL_000c: ldloc.1 IL_000d: ret } // end of method Test::test4 .method private hidebysig static void test5(unsigned int32& 'ret') cil managed { // Code size 11 (0xb) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldloc.0 IL_0004: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0009: stind.i4 IL_000a: ret } // end of method Test::test5 .method private hidebysig static void test6(unsigned int32& 'ret') cil managed { // Code size 12 (0xc) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldloca.s V_0 IL_0005: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000a: stind.i4 IL_000b: ret } // end of method Test::test6 .method private hidebysig static void test7() cil managed { // Code size 14 (0xe) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloc.0 IL_0008: stfld unsigned int32 Test_init_uint32::m_ret IL_000d: ret } // end of method Test::test7 .method private hidebysig static void test8() cil managed { // Code size 27 (0x1b) .maxstack 4 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0009: ldloc.0 IL_000a: ldc.i4.1 IL_000b: shr IL_000c: ldc.i4.1 IL_000d: and IL_000e: ldloc.1 IL_000f: ldc.i4.2 IL_0010: shl IL_0011: sub IL_0012: ldc.i4.s 11 IL_0014: add IL_0015: stfld unsigned int32 Test_init_uint32::m_ret IL_001a: ret } // end of method Test::test8 .method private hidebysig static void test9() cil managed { // Code size 19 (0x13) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloc.0 IL_0008: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000d: stfld unsigned int32 Test_init_uint32::m_ret IL_0012: ret } // end of method Test::test9 .method private hidebysig static void test10() cil managed { // Code size 20 (0x14) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloca.s V_0 IL_0009: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000e: stfld unsigned int32 Test_init_uint32::m_ret IL_0013: ret } // end of method Test::test10 .method private hidebysig static void test11(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 7 (0x7) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloc.0 IL_0005: stelem.i4 IL_0006: ret } // end of method Test::test11 .method private hidebysig static void test12(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 20 (0x14) .maxstack 5 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldarg.0 IL_0005: ldarg.1 IL_0006: ldloc.0 IL_0007: ldc.i4.1 IL_0008: shr IL_0009: ldc.i4.1 IL_000a: and IL_000b: ldloc.1 IL_000c: ldc.i4.2 IL_000d: shl IL_000e: sub IL_000f: ldc.i4.s 11 IL_0011: add IL_0012: stelem.i4 IL_0013: ret } // end of method Test::test12 .method private hidebysig static void test13(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 12 (0xc) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloc.0 IL_0005: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000a: stelem.i4 IL_000b: ret } // end of method Test::test13 .method private hidebysig static void test14(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 13 (0xd) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloca.s V_0 IL_0006: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000b: stelem.i4 IL_000c: ret } // end of method Test::test14 .method private hidebysig static void test15(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 13 (0xd) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloc.0 IL_0007: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_000c: ret } // end of method Test::test15 .method private hidebysig static void test16(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 26 (0x1a) .maxstack 7 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldarg.0 IL_0005: ldarg.1 IL_0006: ldc.i4.2 IL_0007: ldarg.2 IL_0008: ldloc.0 IL_0009: ldc.i4.1 IL_000a: shr IL_000b: ldc.i4.1 IL_000c: and IL_000d: ldloc.1 IL_000e: ldc.i4.2 IL_000f: shl IL_0010: sub IL_0011: ldc.i4.s 11 IL_0013: add IL_0014: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0019: ret } // end of method Test::test16 .method private hidebysig static void test17(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 18 (0x12) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloc.0 IL_0007: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000c: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0011: ret } // end of method Test::test17 .method private hidebysig static void test18(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 19 (0x13) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloca.s V_0 IL_0008: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000d: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0012: ret } // end of method Test::test18 .method private hidebysig static int64 test19() cil managed { // Code size 9 (0x9) .maxstack 1 .locals init (unsigned int32 V_0, int64 V_1) IL_0002: ldloc.0 IL_0003: conv.i8 IL_0004: stloc.1 IL_0005: br.s IL_0007 IL_0007: ldloc.1 IL_0008: ret } // end of method Test::test19 .method private hidebysig static unsigned int64 test20() cil managed { // Code size 23 (0x17) .maxstack 3 .locals init (unsigned int32 V_0, unsigned int32 V_1, unsigned int64 V_2) IL_0004: ldloc.0 IL_0005: ldc.i4.1 IL_0006: shr IL_0007: ldc.i4.1 IL_0008: and IL_0009: ldloc.1 IL_000a: ldc.i4.2 IL_000b: shl IL_000c: sub IL_000d: conv.i8 IL_000e: ldc.i4.s 11 IL_0010: conv.i8 IL_0011: add IL_0012: stloc.2 IL_0013: br.s IL_0015 IL_0015: ldloc.2 IL_0016: ret } // end of method Test::test20 .method private hidebysig static unsigned int8 test21() cil managed { // Code size 14 (0xe) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int8 V_1) IL_0002: ldloc.0 IL_0003: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0008: conv.u1 IL_0009: stloc.1 IL_000a: br.s IL_000c IL_000c: ldloc.1 IL_000d: ret } // end of method Test::test21 .method private hidebysig static unsigned int16 test22() cil managed { // Code size 15 (0xf) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int16 V_1) IL_0002: ldloca.s V_0 IL_0004: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_0009: conv.ovf.u2 IL_000a: stloc.1 IL_000b: br.s IL_000d IL_000d: ldloc.1 IL_000e: ret } // end of method Test::test22 .method private hidebysig static unsigned int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint // Code size 709 (0x2c5) .maxstack 4 .locals init (unsigned int32 V_0, unsigned int32[] V_1, unsigned int32[0...,0...,0...] V_2, unsigned int32 V_3) IL_0000: call unsigned int32 Test_init_uint32::test1() IL_0005: brfalse.s IL_0019 IL_0007: ldstr "Error 101" IL_000c: call void [System.Console]System.Console::WriteLine(string) IL_0011: ldc.i4.s 101 IL_0013: stloc.3 IL_0014: br IL_02c3 IL_0019: call unsigned int32 Test_init_uint32::test2() IL_001e: ldc.i4.s 11 IL_0020: beq.s IL_0034 IL_0022: ldstr "Error 102" IL_0027: call void [System.Console]System.Console::WriteLine(string) IL_002c: ldc.i4.s 102 IL_002e: stloc.3 IL_002f: br IL_02c3 IL_0034: call unsigned int32 Test_init_uint32::test3() IL_0039: brfalse.s IL_004d IL_003b: ldstr "Error 103" IL_0040: call void [System.Console]System.Console::WriteLine(string) IL_0045: ldc.i4.s 103 IL_0047: stloc.3 IL_0048: br IL_02c3 IL_004d: call unsigned int32 Test_init_uint32::test4() IL_0052: brfalse.s IL_0066 IL_0054: ldstr "Error 104" IL_0059: call void [System.Console]System.Console::WriteLine(string) IL_005e: ldc.i4.s 104 IL_0060: stloc.3 IL_0061: br IL_02c3 IL_0066: ldc.i4.0 IL_0067: stloc.0 IL_0068: ldloca.s V_0 IL_006a: call void Test_init_uint32::test5(unsigned int32&) IL_006f: ldloc.0 IL_0070: brfalse.s IL_0084 IL_0072: ldstr "Error 105" IL_0077: call void [System.Console]System.Console::WriteLine(string) IL_007c: ldc.i4.s 105 IL_007e: stloc.3 IL_007f: br IL_02c3 IL_0084: ldloca.s V_0 IL_0086: call void Test_init_uint32::test6(unsigned int32&) IL_008b: ldloc.0 IL_008c: brfalse.s IL_00a0 IL_008e: ldstr "Error 106" IL_0093: call void [System.Console]System.Console::WriteLine(string) IL_0098: ldc.i4.s 106 IL_009a: stloc.3 IL_009b: br IL_02c3 IL_00a0: call void Test_init_uint32::test7() IL_00a5: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00aa: ldfld unsigned int32 Test_init_uint32::m_ret IL_00af: brfalse.s IL_00c3 IL_00b1: ldstr "Error 107" IL_00b6: call void [System.Console]System.Console::WriteLine(string) IL_00bb: ldc.i4.s 107 IL_00bd: stloc.3 IL_00be: br IL_02c3 IL_00c3: call void Test_init_uint32::test8() IL_00c8: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00cd: ldfld unsigned int32 Test_init_uint32::m_ret IL_00d2: ldc.i4.s 11 IL_00d4: beq.s IL_00e8 IL_00d6: ldstr "Error 108" IL_00db: call void [System.Console]System.Console::WriteLine(string) IL_00e0: ldc.i4.s 108 IL_00e2: stloc.3 IL_00e3: br IL_02c3 IL_00e8: call void Test_init_uint32::test9() IL_00ed: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00f2: ldfld unsigned int32 Test_init_uint32::m_ret IL_00f7: brfalse.s IL_010b IL_00f9: ldstr "Error 109" IL_00fe: call void [System.Console]System.Console::WriteLine(string) IL_0103: ldc.i4.s 109 IL_0105: stloc.3 IL_0106: br IL_02c3 IL_010b: call void Test_init_uint32::test10() IL_0110: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0115: ldfld unsigned int32 Test_init_uint32::m_ret IL_011a: brfalse.s IL_012e IL_011c: ldstr "Error 110" IL_0121: call void [System.Console]System.Console::WriteLine(string) IL_0126: ldc.i4.s 110 IL_0128: stloc.3 IL_0129: br IL_02c3 IL_012e: ldc.i4.5 IL_012f: newarr unsigned int32 IL_013f: stloc.1 IL_0140: ldloc.1 IL_0141: ldc.i4.1 IL_0142: call void Test_init_uint32::test11(unsigned int32[], unsigned int32) IL_0147: ldloc.1 IL_0148: ldc.i4.1 IL_0149: ldelem.i4 IL_014a: brfalse.s IL_015e IL_014c: ldstr "Error 111" IL_0151: call void [System.Console]System.Console::WriteLine(string) IL_0156: ldc.i4.s 111 IL_0158: stloc.3 IL_0159: br IL_02c3 IL_015e: ldloc.1 IL_015f: ldc.i4.2 IL_0160: call void Test_init_uint32::test12(unsigned int32[], unsigned int32) IL_0165: ldloc.1 IL_0166: ldc.i4.2 IL_0167: ldelem.i4 IL_0168: ldc.i4.s 11 IL_016a: beq.s IL_017e IL_016c: ldstr "Error 112" IL_0171: call void [System.Console]System.Console::WriteLine(string) IL_0176: ldc.i4.s 112 IL_0178: stloc.3 IL_0179: br IL_02c3 IL_017e: ldloc.1 IL_017f: ldc.i4.3 IL_0180: call void Test_init_uint32::test13(unsigned int32[], unsigned int32) IL_0185: ldloc.1 IL_0186: ldc.i4.3 IL_0187: ldelem.i4 IL_0188: brfalse.s IL_019c IL_018a: ldstr "Error 113" IL_018f: call void [System.Console]System.Console::WriteLine(string) IL_0194: ldc.i4.s 113 IL_0196: stloc.3 IL_0197: br IL_02c3 IL_019c: ldloc.1 IL_019d: ldc.i4.4 IL_019e: call void Test_init_uint32::test14(unsigned int32[], unsigned int32) IL_01a3: ldloc.1 IL_01a4: ldc.i4.4 IL_01a5: ldelem.i4 IL_01a6: brfalse.s IL_01ba IL_01a8: ldstr "Error 114" IL_01ad: call void [System.Console]System.Console::WriteLine(string) IL_01b2: ldc.i4.s 114 IL_01b4: stloc.3 IL_01b5: br IL_02c3 IL_01ba: ldc.i4.5 IL_01bb: ldc.i4.3 IL_01bc: ldc.i4.5 IL_01bd: newobj instance void unsigned int32[0...,0...,0...]::.ctor(int32, int32, int32) IL_01c2: stloc.2 IL_01c3: ldloc.2 IL_01c4: ldc.i4.1 IL_01c5: ldc.i4.1 IL_01c6: call void Test_init_uint32::test15(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_01cb: ldloc.2 IL_01cc: ldc.i4.1 IL_01cd: ldc.i4.2 IL_01ce: ldc.i4.1 IL_01cf: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_01d4: brfalse.s IL_01e8 IL_01d6: ldstr "Error 115" IL_01db: call void [System.Console]System.Console::WriteLine(string) IL_01e0: ldc.i4.s 115 IL_01e2: stloc.3 IL_01e3: br IL_02c3 IL_01e8: ldloc.2 IL_01e9: ldc.i4.2 IL_01ea: ldc.i4.2 IL_01eb: call void Test_init_uint32::test16(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_01f0: ldloc.2 IL_01f1: ldc.i4.2 IL_01f2: ldc.i4.2 IL_01f3: ldc.i4.2 IL_01f4: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_01f9: ldc.i4.s 11 IL_01fb: beq.s IL_020f IL_01fd: ldstr "Error 116" IL_0202: call void [System.Console]System.Console::WriteLine(string) IL_0207: ldc.i4.s 116 IL_0209: stloc.3 IL_020a: br IL_02c3 IL_020f: ldloc.2 IL_0210: ldc.i4.3 IL_0211: ldc.i4.3 IL_0212: call void Test_init_uint32::test17(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_0217: ldloc.2 IL_0218: ldc.i4.3 IL_0219: ldc.i4.2 IL_021a: ldc.i4.3 IL_021b: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_0220: brfalse.s IL_0234 IL_0222: ldstr "Error 117" IL_0227: call void [System.Console]System.Console::WriteLine(string) IL_022c: ldc.i4.s 117 IL_022e: stloc.3 IL_022f: br IL_02c3 IL_0234: ldloc.2 IL_0235: ldc.i4.4 IL_0236: ldc.i4.4 IL_0237: call void Test_init_uint32::test18(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_023c: ldloc.2 IL_023d: ldc.i4.4 IL_023e: ldc.i4.2 IL_023f: ldc.i4.4 IL_0240: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_0245: brfalse.s IL_0256 IL_0247: ldstr "Error 118" IL_024c: call void [System.Console]System.Console::WriteLine(string) IL_0251: ldc.i4.s 118 IL_0253: stloc.3 IL_0254: br.s IL_02c3 IL_0256: call int64 Test_init_uint32::test19() IL_025b: ldc.i4.0 IL_025c: conv.i8 IL_025d: beq.s IL_026e IL_025f: ldstr "Error 119" IL_0264: call void [System.Console]System.Console::WriteLine(string) IL_0269: ldc.i4.s 119 IL_026b: stloc.3 IL_026c: br.s IL_02c3 IL_026e: call unsigned int64 Test_init_uint32::test20() IL_0273: ldc.i4.s 11 IL_0275: conv.i8 IL_0276: beq.s IL_0287 IL_0278: ldstr "Error 120" IL_027d: call void [System.Console]System.Console::WriteLine(string) IL_0282: ldc.i4.s 120 IL_0284: stloc.3 IL_0285: br.s IL_02c3 IL_0287: call unsigned int8 Test_init_uint32::test21() IL_028c: brfalse.s IL_029d IL_028e: ldstr "Error 121" IL_0293: call void [System.Console]System.Console::WriteLine(string) IL_0298: ldc.i4.s 121 IL_029a: stloc.3 IL_029b: br.s IL_02c3 IL_029d: call unsigned int16 Test_init_uint32::test22() IL_02a2: conv.i4 IL_02a3: brfalse.s IL_02b4 IL_02a5: ldstr "Error 122" IL_02aa: call void [System.Console]System.Console::WriteLine(string) IL_02af: ldc.i4.s 122 IL_02b1: stloc.3 IL_02b2: br.s IL_02c3 IL_02b4: ldstr "Passed" IL_02b9: call void [System.Console]System.Console::WriteLine(string) IL_02be: ldc.i4.s 100 IL_02c0: stloc.3 IL_02c1: br.s IL_02c3 IL_02c3: ldloc.3 IL_02c4: ret } // end of method Test::Main .method private hidebysig specialname rtspecialname static void .cctor() cil managed { // Code size 11 (0xb) .maxstack 1 IL_0000: newobj instance void Test_init_uint32::.ctor() IL_0005: stsfld class Test_init_uint32 Test_init_uint32::global IL_000a: ret } // end of method Test::.cctor .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 14 (0xe) .maxstack 2 IL_0000: ldarg.0 IL_0001: ldc.i4.0 IL_0002: stfld unsigned int32 Test_init_uint32::m_ret IL_0007: ldarg.0 IL_0008: call instance void [mscorlib]System.Object::.ctor() IL_000d: ret } // end of method Test::.ctor } // end of class Test
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { } .assembly extern xunit.core {} .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } .assembly init_uint32 { } .class private auto ansi beforefieldinit Test_init_uint32 extends [mscorlib]System.Object { .field private unsigned int32 m_ret .field private static class Test_init_uint32 global .method private hidebysig static unsigned int32 noinline1(unsigned int32 'ret') cil managed { .maxstack 1 ldarga.s 0 ldind.i4 ret } .method private hidebysig static unsigned int32 noinline2(unsigned int32& 'ret') cil managed { .maxstack 1 ldarga.s 0 ldind.i ldind.i4 ret } // end of method Test::noinline2 .method private hidebysig static unsigned int32 test1() cil managed { // Code size 8 (0x8) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0006: ldloc.1 IL_0007: ret } // end of method Test::test1 .method private hidebysig static unsigned int32 test2() cil managed { // Code size 21 (0x15) .maxstack 3 .locals init (unsigned int32 V_0, unsigned int32 V_1, unsigned int32 V_2) IL_0004: ldloc.0 IL_0005: ldc.i4.1 IL_0006: shr IL_0007: ldc.i4.1 IL_0008: and IL_0009: ldloc.1 IL_000a: ldc.i4.2 IL_000b: shl IL_000c: sub IL_000d: ldc.i4.s 11 IL_000f: add IL_0010: stloc.2 IL_0011: br.s IL_0013 IL_0013: ldloc.2 IL_0014: ret } // end of method Test::test2 .method private hidebysig static unsigned int32 test3() cil managed { // Code size 13 (0xd) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0002: ldloc.0 IL_0003: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0008: stloc.1 IL_0009: br.s IL_000b IL_000b: ldloc.1 IL_000c: ret } // end of method Test::test3 .method private hidebysig static unsigned int32 test4() cil managed { // Code size 14 (0xe) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0002: ldloca.s V_0 IL_0004: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_0009: stloc.1 IL_000a: br.s IL_000c IL_000c: ldloc.1 IL_000d: ret } // end of method Test::test4 .method private hidebysig static void test5(unsigned int32& 'ret') cil managed { // Code size 11 (0xb) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldloc.0 IL_0004: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0009: stind.i4 IL_000a: ret } // end of method Test::test5 .method private hidebysig static void test6(unsigned int32& 'ret') cil managed { // Code size 12 (0xc) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldloca.s V_0 IL_0005: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000a: stind.i4 IL_000b: ret } // end of method Test::test6 .method private hidebysig static void test7() cil managed { // Code size 14 (0xe) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloc.0 IL_0008: stfld unsigned int32 Test_init_uint32::m_ret IL_000d: ret } // end of method Test::test7 .method private hidebysig static void test8() cil managed { // Code size 27 (0x1b) .maxstack 4 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0009: ldloc.0 IL_000a: ldc.i4.1 IL_000b: shr IL_000c: ldc.i4.1 IL_000d: and IL_000e: ldloc.1 IL_000f: ldc.i4.2 IL_0010: shl IL_0011: sub IL_0012: ldc.i4.s 11 IL_0014: add IL_0015: stfld unsigned int32 Test_init_uint32::m_ret IL_001a: ret } // end of method Test::test8 .method private hidebysig static void test9() cil managed { // Code size 19 (0x13) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloc.0 IL_0008: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000d: stfld unsigned int32 Test_init_uint32::m_ret IL_0012: ret } // end of method Test::test9 .method private hidebysig static void test10() cil managed { // Code size 20 (0x14) .maxstack 2 .locals init (unsigned int32 V_0) IL_0002: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0007: ldloca.s V_0 IL_0009: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000e: stfld unsigned int32 Test_init_uint32::m_ret IL_0013: ret } // end of method Test::test10 .method private hidebysig static void test11(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 7 (0x7) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloc.0 IL_0005: stelem.i4 IL_0006: ret } // end of method Test::test11 .method private hidebysig static void test12(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 20 (0x14) .maxstack 5 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldarg.0 IL_0005: ldarg.1 IL_0006: ldloc.0 IL_0007: ldc.i4.1 IL_0008: shr IL_0009: ldc.i4.1 IL_000a: and IL_000b: ldloc.1 IL_000c: ldc.i4.2 IL_000d: shl IL_000e: sub IL_000f: ldc.i4.s 11 IL_0011: add IL_0012: stelem.i4 IL_0013: ret } // end of method Test::test12 .method private hidebysig static void test13(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 12 (0xc) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloc.0 IL_0005: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000a: stelem.i4 IL_000b: ret } // end of method Test::test13 .method private hidebysig static void test14(unsigned int32[] arr, unsigned int32 index) cil managed { // Code size 13 (0xd) .maxstack 3 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldloca.s V_0 IL_0006: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000b: stelem.i4 IL_000c: ret } // end of method Test::test14 .method private hidebysig static void test15(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 13 (0xd) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloc.0 IL_0007: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_000c: ret } // end of method Test::test15 .method private hidebysig static void test16(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 26 (0x1a) .maxstack 7 .locals init (unsigned int32 V_0, unsigned int32 V_1) IL_0004: ldarg.0 IL_0005: ldarg.1 IL_0006: ldc.i4.2 IL_0007: ldarg.2 IL_0008: ldloc.0 IL_0009: ldc.i4.1 IL_000a: shr IL_000b: ldc.i4.1 IL_000c: and IL_000d: ldloc.1 IL_000e: ldc.i4.2 IL_000f: shl IL_0010: sub IL_0011: ldc.i4.s 11 IL_0013: add IL_0014: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0019: ret } // end of method Test::test16 .method private hidebysig static void test17(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 18 (0x12) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloc.0 IL_0007: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_000c: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0011: ret } // end of method Test::test17 .method private hidebysig static void test18(unsigned int32[0...,0...,0...] arr, unsigned int32 index1, unsigned int32 index3) cil managed { // Code size 19 (0x13) .maxstack 5 .locals init (unsigned int32 V_0) IL_0002: ldarg.0 IL_0003: ldarg.1 IL_0004: ldc.i4.2 IL_0005: ldarg.2 IL_0006: ldloca.s V_0 IL_0008: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_000d: call instance void unsigned int32[0...,0...,0...]::Set(int32, int32, int32, unsigned int32) IL_0012: ret } // end of method Test::test18 .method private hidebysig static int64 test19() cil managed { // Code size 9 (0x9) .maxstack 1 .locals init (unsigned int32 V_0, int64 V_1) IL_0002: ldloc.0 IL_0003: conv.i8 IL_0004: stloc.1 IL_0005: br.s IL_0007 IL_0007: ldloc.1 IL_0008: ret } // end of method Test::test19 .method private hidebysig static unsigned int64 test20() cil managed { // Code size 23 (0x17) .maxstack 3 .locals init (unsigned int32 V_0, unsigned int32 V_1, unsigned int64 V_2) IL_0004: ldloc.0 IL_0005: ldc.i4.1 IL_0006: shr IL_0007: ldc.i4.1 IL_0008: and IL_0009: ldloc.1 IL_000a: ldc.i4.2 IL_000b: shl IL_000c: sub IL_000d: conv.i8 IL_000e: ldc.i4.s 11 IL_0010: conv.i8 IL_0011: add IL_0012: stloc.2 IL_0013: br.s IL_0015 IL_0015: ldloc.2 IL_0016: ret } // end of method Test::test20 .method private hidebysig static unsigned int8 test21() cil managed { // Code size 14 (0xe) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int8 V_1) IL_0002: ldloc.0 IL_0003: call unsigned int32 Test_init_uint32::noinline1(unsigned int32) IL_0008: conv.u1 IL_0009: stloc.1 IL_000a: br.s IL_000c IL_000c: ldloc.1 IL_000d: ret } // end of method Test::test21 .method private hidebysig static unsigned int16 test22() cil managed { // Code size 15 (0xf) .maxstack 1 .locals init (unsigned int32 V_0, unsigned int16 V_1) IL_0002: ldloca.s V_0 IL_0004: call unsigned int32 Test_init_uint32::noinline2(unsigned int32&) IL_0009: conv.ovf.u2 IL_000a: stloc.1 IL_000b: br.s IL_000d IL_000d: ldloc.1 IL_000e: ret } // end of method Test::test22 .method private hidebysig static unsigned int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint // Code size 709 (0x2c5) .maxstack 4 .locals init (unsigned int32 V_0, unsigned int32[] V_1, unsigned int32[0...,0...,0...] V_2, unsigned int32 V_3) IL_0000: call unsigned int32 Test_init_uint32::test1() IL_0005: brfalse.s IL_0019 IL_0007: ldstr "Error 101" IL_000c: call void [System.Console]System.Console::WriteLine(string) IL_0011: ldc.i4.s 101 IL_0013: stloc.3 IL_0014: br IL_02c3 IL_0019: call unsigned int32 Test_init_uint32::test2() IL_001e: ldc.i4.s 11 IL_0020: beq.s IL_0034 IL_0022: ldstr "Error 102" IL_0027: call void [System.Console]System.Console::WriteLine(string) IL_002c: ldc.i4.s 102 IL_002e: stloc.3 IL_002f: br IL_02c3 IL_0034: call unsigned int32 Test_init_uint32::test3() IL_0039: brfalse.s IL_004d IL_003b: ldstr "Error 103" IL_0040: call void [System.Console]System.Console::WriteLine(string) IL_0045: ldc.i4.s 103 IL_0047: stloc.3 IL_0048: br IL_02c3 IL_004d: call unsigned int32 Test_init_uint32::test4() IL_0052: brfalse.s IL_0066 IL_0054: ldstr "Error 104" IL_0059: call void [System.Console]System.Console::WriteLine(string) IL_005e: ldc.i4.s 104 IL_0060: stloc.3 IL_0061: br IL_02c3 IL_0066: ldc.i4.0 IL_0067: stloc.0 IL_0068: ldloca.s V_0 IL_006a: call void Test_init_uint32::test5(unsigned int32&) IL_006f: ldloc.0 IL_0070: brfalse.s IL_0084 IL_0072: ldstr "Error 105" IL_0077: call void [System.Console]System.Console::WriteLine(string) IL_007c: ldc.i4.s 105 IL_007e: stloc.3 IL_007f: br IL_02c3 IL_0084: ldloca.s V_0 IL_0086: call void Test_init_uint32::test6(unsigned int32&) IL_008b: ldloc.0 IL_008c: brfalse.s IL_00a0 IL_008e: ldstr "Error 106" IL_0093: call void [System.Console]System.Console::WriteLine(string) IL_0098: ldc.i4.s 106 IL_009a: stloc.3 IL_009b: br IL_02c3 IL_00a0: call void Test_init_uint32::test7() IL_00a5: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00aa: ldfld unsigned int32 Test_init_uint32::m_ret IL_00af: brfalse.s IL_00c3 IL_00b1: ldstr "Error 107" IL_00b6: call void [System.Console]System.Console::WriteLine(string) IL_00bb: ldc.i4.s 107 IL_00bd: stloc.3 IL_00be: br IL_02c3 IL_00c3: call void Test_init_uint32::test8() IL_00c8: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00cd: ldfld unsigned int32 Test_init_uint32::m_ret IL_00d2: ldc.i4.s 11 IL_00d4: beq.s IL_00e8 IL_00d6: ldstr "Error 108" IL_00db: call void [System.Console]System.Console::WriteLine(string) IL_00e0: ldc.i4.s 108 IL_00e2: stloc.3 IL_00e3: br IL_02c3 IL_00e8: call void Test_init_uint32::test9() IL_00ed: ldsfld class Test_init_uint32 Test_init_uint32::global IL_00f2: ldfld unsigned int32 Test_init_uint32::m_ret IL_00f7: brfalse.s IL_010b IL_00f9: ldstr "Error 109" IL_00fe: call void [System.Console]System.Console::WriteLine(string) IL_0103: ldc.i4.s 109 IL_0105: stloc.3 IL_0106: br IL_02c3 IL_010b: call void Test_init_uint32::test10() IL_0110: ldsfld class Test_init_uint32 Test_init_uint32::global IL_0115: ldfld unsigned int32 Test_init_uint32::m_ret IL_011a: brfalse.s IL_012e IL_011c: ldstr "Error 110" IL_0121: call void [System.Console]System.Console::WriteLine(string) IL_0126: ldc.i4.s 110 IL_0128: stloc.3 IL_0129: br IL_02c3 IL_012e: ldc.i4.5 IL_012f: newarr unsigned int32 IL_013f: stloc.1 IL_0140: ldloc.1 IL_0141: ldc.i4.1 IL_0142: call void Test_init_uint32::test11(unsigned int32[], unsigned int32) IL_0147: ldloc.1 IL_0148: ldc.i4.1 IL_0149: ldelem.i4 IL_014a: brfalse.s IL_015e IL_014c: ldstr "Error 111" IL_0151: call void [System.Console]System.Console::WriteLine(string) IL_0156: ldc.i4.s 111 IL_0158: stloc.3 IL_0159: br IL_02c3 IL_015e: ldloc.1 IL_015f: ldc.i4.2 IL_0160: call void Test_init_uint32::test12(unsigned int32[], unsigned int32) IL_0165: ldloc.1 IL_0166: ldc.i4.2 IL_0167: ldelem.i4 IL_0168: ldc.i4.s 11 IL_016a: beq.s IL_017e IL_016c: ldstr "Error 112" IL_0171: call void [System.Console]System.Console::WriteLine(string) IL_0176: ldc.i4.s 112 IL_0178: stloc.3 IL_0179: br IL_02c3 IL_017e: ldloc.1 IL_017f: ldc.i4.3 IL_0180: call void Test_init_uint32::test13(unsigned int32[], unsigned int32) IL_0185: ldloc.1 IL_0186: ldc.i4.3 IL_0187: ldelem.i4 IL_0188: brfalse.s IL_019c IL_018a: ldstr "Error 113" IL_018f: call void [System.Console]System.Console::WriteLine(string) IL_0194: ldc.i4.s 113 IL_0196: stloc.3 IL_0197: br IL_02c3 IL_019c: ldloc.1 IL_019d: ldc.i4.4 IL_019e: call void Test_init_uint32::test14(unsigned int32[], unsigned int32) IL_01a3: ldloc.1 IL_01a4: ldc.i4.4 IL_01a5: ldelem.i4 IL_01a6: brfalse.s IL_01ba IL_01a8: ldstr "Error 114" IL_01ad: call void [System.Console]System.Console::WriteLine(string) IL_01b2: ldc.i4.s 114 IL_01b4: stloc.3 IL_01b5: br IL_02c3 IL_01ba: ldc.i4.5 IL_01bb: ldc.i4.3 IL_01bc: ldc.i4.5 IL_01bd: newobj instance void unsigned int32[0...,0...,0...]::.ctor(int32, int32, int32) IL_01c2: stloc.2 IL_01c3: ldloc.2 IL_01c4: ldc.i4.1 IL_01c5: ldc.i4.1 IL_01c6: call void Test_init_uint32::test15(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_01cb: ldloc.2 IL_01cc: ldc.i4.1 IL_01cd: ldc.i4.2 IL_01ce: ldc.i4.1 IL_01cf: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_01d4: brfalse.s IL_01e8 IL_01d6: ldstr "Error 115" IL_01db: call void [System.Console]System.Console::WriteLine(string) IL_01e0: ldc.i4.s 115 IL_01e2: stloc.3 IL_01e3: br IL_02c3 IL_01e8: ldloc.2 IL_01e9: ldc.i4.2 IL_01ea: ldc.i4.2 IL_01eb: call void Test_init_uint32::test16(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_01f0: ldloc.2 IL_01f1: ldc.i4.2 IL_01f2: ldc.i4.2 IL_01f3: ldc.i4.2 IL_01f4: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_01f9: ldc.i4.s 11 IL_01fb: beq.s IL_020f IL_01fd: ldstr "Error 116" IL_0202: call void [System.Console]System.Console::WriteLine(string) IL_0207: ldc.i4.s 116 IL_0209: stloc.3 IL_020a: br IL_02c3 IL_020f: ldloc.2 IL_0210: ldc.i4.3 IL_0211: ldc.i4.3 IL_0212: call void Test_init_uint32::test17(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_0217: ldloc.2 IL_0218: ldc.i4.3 IL_0219: ldc.i4.2 IL_021a: ldc.i4.3 IL_021b: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_0220: brfalse.s IL_0234 IL_0222: ldstr "Error 117" IL_0227: call void [System.Console]System.Console::WriteLine(string) IL_022c: ldc.i4.s 117 IL_022e: stloc.3 IL_022f: br IL_02c3 IL_0234: ldloc.2 IL_0235: ldc.i4.4 IL_0236: ldc.i4.4 IL_0237: call void Test_init_uint32::test18(unsigned int32[0...,0...,0...], unsigned int32, unsigned int32) IL_023c: ldloc.2 IL_023d: ldc.i4.4 IL_023e: ldc.i4.2 IL_023f: ldc.i4.4 IL_0240: call instance int32 int32[0...,0...,0...]::Get(int32, int32, int32) IL_0245: brfalse.s IL_0256 IL_0247: ldstr "Error 118" IL_024c: call void [System.Console]System.Console::WriteLine(string) IL_0251: ldc.i4.s 118 IL_0253: stloc.3 IL_0254: br.s IL_02c3 IL_0256: call int64 Test_init_uint32::test19() IL_025b: ldc.i4.0 IL_025c: conv.i8 IL_025d: beq.s IL_026e IL_025f: ldstr "Error 119" IL_0264: call void [System.Console]System.Console::WriteLine(string) IL_0269: ldc.i4.s 119 IL_026b: stloc.3 IL_026c: br.s IL_02c3 IL_026e: call unsigned int64 Test_init_uint32::test20() IL_0273: ldc.i4.s 11 IL_0275: conv.i8 IL_0276: beq.s IL_0287 IL_0278: ldstr "Error 120" IL_027d: call void [System.Console]System.Console::WriteLine(string) IL_0282: ldc.i4.s 120 IL_0284: stloc.3 IL_0285: br.s IL_02c3 IL_0287: call unsigned int8 Test_init_uint32::test21() IL_028c: brfalse.s IL_029d IL_028e: ldstr "Error 121" IL_0293: call void [System.Console]System.Console::WriteLine(string) IL_0298: ldc.i4.s 121 IL_029a: stloc.3 IL_029b: br.s IL_02c3 IL_029d: call unsigned int16 Test_init_uint32::test22() IL_02a2: conv.i4 IL_02a3: brfalse.s IL_02b4 IL_02a5: ldstr "Error 122" IL_02aa: call void [System.Console]System.Console::WriteLine(string) IL_02af: ldc.i4.s 122 IL_02b1: stloc.3 IL_02b2: br.s IL_02c3 IL_02b4: ldstr "Passed" IL_02b9: call void [System.Console]System.Console::WriteLine(string) IL_02be: ldc.i4.s 100 IL_02c0: stloc.3 IL_02c1: br.s IL_02c3 IL_02c3: ldloc.3 IL_02c4: ret } // end of method Test::Main .method private hidebysig specialname rtspecialname static void .cctor() cil managed { // Code size 11 (0xb) .maxstack 1 IL_0000: newobj instance void Test_init_uint32::.ctor() IL_0005: stsfld class Test_init_uint32 Test_init_uint32::global IL_000a: ret } // end of method Test::.cctor .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 14 (0xe) .maxstack 2 IL_0000: ldarg.0 IL_0001: ldc.i4.0 IL_0002: stfld unsigned int32 Test_init_uint32::m_ret IL_0007: ldarg.0 IL_0008: call instance void [mscorlib]System.Object::.ctor() IL_000d: ret } // end of method Test::.ctor } // end of class Test
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/opt/perf/doublenegate/doublenegate.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType>None</DebugType> </PropertyGroup> <PropertyGroup> </PropertyGroup> <ItemGroup> <Compile Include="doublenegate.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType>None</DebugType> </PropertyGroup> <PropertyGroup> </PropertyGroup> <ItemGroup> <Compile Include="doublenegate.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Intrinsics/MathRoundDouble.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; namespace MathRoundDoubleTest { class Program { public const int Pass = 100; public const int Fail = 0; public const double constantValue = 0.0; public static double staticValue = 1.1; public static double[] staticValueArray = new double[] { 2.2, 3.3, 4.4 }; public double instanceValue = 5.5; public double[] instanceValueArray = new double[] { 6.6, 7.7, 8.8 }; unsafe static int Main(string[] args) { double localValue = 9.9; var program = new Program(); if (Math.Round(constantValue) != 0.0) { Console.WriteLine("Math.Round of a constant value failed"); return Fail; } if (Math.Round(staticValue) != 1.0) { Console.WriteLine("Math.Round of a static value failed"); return Fail; } fixed (double* pStaticValue = &staticValue) { if (Math.Round(*pStaticValue) != 1.0) { Console.WriteLine("Math.Round of an addressed static value failed"); return Fail; } } if (Math.Round(staticValueArray[0]) != 2.0) { Console.WriteLine("Math.Round of a static value array (index 0) failed"); return Fail; } if (Math.Round(staticValueArray[1]) != 3.0) { Console.WriteLine("Math.Round of a static value array (index 1) failed"); return Fail; } if (Math.Round(staticValueArray[2]) != 4.0) { Console.WriteLine("Math.Round of a static value array (index 2) failed"); return Fail; } fixed (double* pStaticValueArray = &staticValueArray[0]) { if (Math.Round(pStaticValueArray[0]) != 2.0) { Console.WriteLine("Math.Round of a addressed static value array (index 0) failed"); return Fail; } if (Math.Round(pStaticValueArray[1]) != 3.0) { Console.WriteLine("Math.Round of a addressed static value array (index 1) failed"); return Fail; } if (Math.Round(pStaticValueArray[2]) != 4.0) { Console.WriteLine("Math.Round of a addressed static value array (index 2) failed"); return Fail; } } if (Math.Round(program.instanceValue) != 6.0) { Console.WriteLine("Math.Round of an instance value failed"); return Fail; } fixed (double* pInstanceValue = &program.instanceValue) { if (Math.Round(*pInstanceValue) != 6.0) { Console.WriteLine("Math.Round of an addressed instance value failed"); return Fail; } } if (Math.Round(program.instanceValueArray[0]) != 7.0) { Console.WriteLine("Math.Round of an instance value array (index 0) failed"); return Fail; } if (Math.Round(program.instanceValueArray[1]) != 8.0) { Console.WriteLine("Math.Round of an instance value array (index 1) failed"); return Fail; } if (Math.Round(program.instanceValueArray[2]) != 9.0) { Console.WriteLine("Math.Round of an instance value array (index 2) failed"); return Fail; } fixed (double* pInstanceValueArray = &program.instanceValueArray[0]) { if (Math.Round(pInstanceValueArray[0]) != 7.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 0) failed"); return Fail; } if (Math.Round(pInstanceValueArray[1]) != 8.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 1) failed"); return Fail; } if (Math.Round(pInstanceValueArray[2]) != 9.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 2) failed"); return Fail; } } if (Math.Round(localValue) != 10.0) { Console.WriteLine("Math.Round of a local value failed"); return Fail; } double* pLocalValue = &localValue; if (Math.Round(*pLocalValue) != 10.0) { Console.WriteLine("Math.Round of an addressed local value failed"); return Fail; } return Pass; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; namespace MathRoundDoubleTest { class Program { public const int Pass = 100; public const int Fail = 0; public const double constantValue = 0.0; public static double staticValue = 1.1; public static double[] staticValueArray = new double[] { 2.2, 3.3, 4.4 }; public double instanceValue = 5.5; public double[] instanceValueArray = new double[] { 6.6, 7.7, 8.8 }; unsafe static int Main(string[] args) { double localValue = 9.9; var program = new Program(); if (Math.Round(constantValue) != 0.0) { Console.WriteLine("Math.Round of a constant value failed"); return Fail; } if (Math.Round(staticValue) != 1.0) { Console.WriteLine("Math.Round of a static value failed"); return Fail; } fixed (double* pStaticValue = &staticValue) { if (Math.Round(*pStaticValue) != 1.0) { Console.WriteLine("Math.Round of an addressed static value failed"); return Fail; } } if (Math.Round(staticValueArray[0]) != 2.0) { Console.WriteLine("Math.Round of a static value array (index 0) failed"); return Fail; } if (Math.Round(staticValueArray[1]) != 3.0) { Console.WriteLine("Math.Round of a static value array (index 1) failed"); return Fail; } if (Math.Round(staticValueArray[2]) != 4.0) { Console.WriteLine("Math.Round of a static value array (index 2) failed"); return Fail; } fixed (double* pStaticValueArray = &staticValueArray[0]) { if (Math.Round(pStaticValueArray[0]) != 2.0) { Console.WriteLine("Math.Round of a addressed static value array (index 0) failed"); return Fail; } if (Math.Round(pStaticValueArray[1]) != 3.0) { Console.WriteLine("Math.Round of a addressed static value array (index 1) failed"); return Fail; } if (Math.Round(pStaticValueArray[2]) != 4.0) { Console.WriteLine("Math.Round of a addressed static value array (index 2) failed"); return Fail; } } if (Math.Round(program.instanceValue) != 6.0) { Console.WriteLine("Math.Round of an instance value failed"); return Fail; } fixed (double* pInstanceValue = &program.instanceValue) { if (Math.Round(*pInstanceValue) != 6.0) { Console.WriteLine("Math.Round of an addressed instance value failed"); return Fail; } } if (Math.Round(program.instanceValueArray[0]) != 7.0) { Console.WriteLine("Math.Round of an instance value array (index 0) failed"); return Fail; } if (Math.Round(program.instanceValueArray[1]) != 8.0) { Console.WriteLine("Math.Round of an instance value array (index 1) failed"); return Fail; } if (Math.Round(program.instanceValueArray[2]) != 9.0) { Console.WriteLine("Math.Round of an instance value array (index 2) failed"); return Fail; } fixed (double* pInstanceValueArray = &program.instanceValueArray[0]) { if (Math.Round(pInstanceValueArray[0]) != 7.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 0) failed"); return Fail; } if (Math.Round(pInstanceValueArray[1]) != 8.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 1) failed"); return Fail; } if (Math.Round(pInstanceValueArray[2]) != 9.0) { Console.WriteLine("Math.Round of a addressed instance value array (index 2) failed"); return Fail; } } if (Math.Round(localValue) != 10.0) { Console.WriteLine("Math.Round of a local value failed"); return Fail; } double* pLocalValue = &localValue; if (Math.Round(*pLocalValue) != 10.0) { Console.WriteLine("Math.Round of an addressed local value failed"); return Fail; } return Pass; } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Methodical/int64/misc/binop_d.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="binop.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="binop.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/coreclr/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /*===================================================================== ** ** Source: test3.c ** ** Purpose: Test #3 for the vsprintf function. ** ** **===================================================================*/ #include <palsuite.h> #include "../vsprintf.h" /* * Notes: memcmp is used, as is strlen. */ PALTEST(c_runtime_vsprintf_test3_paltest_vsprintf_test3, "c_runtime/vsprintf/test3/paltest_vsprintf_test3") { if (PAL_Initialize(argc, argv) != 0) { return(FAIL); } DoWStrTest("foo %S", convert("bar"), "foo bar"); DoStrTest("foo %hS", "bar", "foo bar"); DoWStrTest("foo %lS", convert("bar"), "foo bar"); DoWStrTest("foo %wS", convert("bar"), "foo bar"); DoWStrTest("foo %LS", convert("bar"), "foo bar"); DoWStrTest("foo %I64S", convert("bar"), "foo bar"); DoWStrTest("foo %5S", convert("bar"), "foo bar"); DoWStrTest("foo %.2S", convert("bar"), "foo ba"); DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); DoWStrTest("foo %-5S", convert("bar"), "foo bar "); DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); DoWStrTest("foo %S", NULL, "foo (null)"); DoStrTest("foo %hS", NULL, "foo (null)"); DoWStrTest("foo %lS", NULL, "foo (null)"); DoWStrTest("foo %wS", NULL, "foo (null)"); DoWStrTest("foo %LS", NULL, "foo (null)"); DoWStrTest("foo %I64S", NULL, "foo (null)"); PAL_Terminate(); return PASS; }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /*===================================================================== ** ** Source: test3.c ** ** Purpose: Test #3 for the vsprintf function. ** ** **===================================================================*/ #include <palsuite.h> #include "../vsprintf.h" /* * Notes: memcmp is used, as is strlen. */ PALTEST(c_runtime_vsprintf_test3_paltest_vsprintf_test3, "c_runtime/vsprintf/test3/paltest_vsprintf_test3") { if (PAL_Initialize(argc, argv) != 0) { return(FAIL); } DoWStrTest("foo %S", convert("bar"), "foo bar"); DoStrTest("foo %hS", "bar", "foo bar"); DoWStrTest("foo %lS", convert("bar"), "foo bar"); DoWStrTest("foo %wS", convert("bar"), "foo bar"); DoWStrTest("foo %LS", convert("bar"), "foo bar"); DoWStrTest("foo %I64S", convert("bar"), "foo bar"); DoWStrTest("foo %5S", convert("bar"), "foo bar"); DoWStrTest("foo %.2S", convert("bar"), "foo ba"); DoWStrTest("foo %5.2S", convert("bar"), "foo ba"); DoWStrTest("foo %-5S", convert("bar"), "foo bar "); DoWStrTest("foo %05S", convert("bar"), "foo 00bar"); DoWStrTest("foo %S", NULL, "foo (null)"); DoStrTest("foo %hS", NULL, "foo (null)"); DoWStrTest("foo %lS", NULL, "foo (null)"); DoWStrTest("foo %wS", NULL, "foo (null)"); DoWStrTest("foo %LS", NULL, "foo (null)"); DoWStrTest("foo %I64S", NULL, "foo (null)"); PAL_Terminate(); return PASS; }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector256/Add.Byte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void AddByte() { var test = new VectorBinaryOpTest__AddByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__AddByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Byte[] inArray1, Byte[] inArray2, Byte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Byte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Byte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Byte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Byte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Byte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector256<Byte> _fld1; public Vector256<Byte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__AddByte testClass) { var result = Vector256.Add(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector256<Byte> _clsVar1; private static Vector256<Byte> _clsVar2; private Vector256<Byte> _fld1; private Vector256<Byte> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__AddByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); } public VectorBinaryOpTest__AddByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } _dataTable = new DataTable(_data1, _data2, new Byte[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector256.Add( Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector256).GetMethod(nameof(Vector256.Add), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }); if (method is null) { method = typeof(Vector256).GetMethod(nameof(Vector256.Add), 1, new Type[] { typeof(Vector256<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector256<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Byte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector256.Add( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr); var result = Vector256.Add(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__AddByte(); var result = Vector256.Add(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector256.Add(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector256.Add(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector256<Byte> op1, Vector256<Byte> op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (byte)(left[0] + right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (byte)(left[i] + right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector256)}.{nameof(Vector256.Add)}<Byte>(Vector256<Byte>, Vector256<Byte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void AddByte() { var test = new VectorBinaryOpTest__AddByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__AddByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Byte[] inArray1, Byte[] inArray2, Byte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Byte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Byte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Byte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Byte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Byte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector256<Byte> _fld1; public Vector256<Byte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__AddByte testClass) { var result = Vector256.Add(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector256<Byte> _clsVar1; private static Vector256<Byte> _clsVar2; private Vector256<Byte> _fld1; private Vector256<Byte> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__AddByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); } public VectorBinaryOpTest__AddByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } _dataTable = new DataTable(_data1, _data2, new Byte[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector256.Add( Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector256).GetMethod(nameof(Vector256.Add), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }); if (method is null) { method = typeof(Vector256).GetMethod(nameof(Vector256.Add), 1, new Type[] { typeof(Vector256<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector256<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Byte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector256.Add( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr); var result = Vector256.Add(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__AddByte(); var result = Vector256.Add(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector256.Add(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector256.Add(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector256<Byte> op1, Vector256<Byte> op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (byte)(left[0] + right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (byte)(left[i] + right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector256)}.{nameof(Vector256.Add)}<Byte>(Vector256<Byte>, Vector256<Byte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./docs/design/features/host-error-codes.md
# Hosting layer error and exit codes This document lists all the values returned as special exit codes when running `dotnet.exe` or `apphost` or returned by the hosting APIs (`hostfxr`, `hostpolicy` and `nethost`). Those exit codes are also specified in signed 32-bit form (what you would see if you run `echo %ERRORLEVEL%` on Winodws) and in 8-bit form (what you would see if you run `echo $?` on Linux). Note that the exit code returned by running an application via `dotnet.exe` or `apphost` can either be one of the below values or the exit code of the managed application itself. ### Success error/exit codes | Name | Value | Value (signed, 32-bit) | Value (8-bit) | Description | | ------------------------------------- | ------------ | ---------------------- | ------------- | ----------- | | `Success` | `0x00000000` | `0` | `0` | Operation was successful. | | `Success_HostAlreadyInitialized` | `0x00000001` | `1` | `1` | Initialization was successful, but another host context is already initialized, so the returned context is "secondary". The requested context was otherwise fully compatible with the already initialized context. This is returned by `hostfxr_initialize_for_runtime_config` if it's called when the host is already initialized in the process. Comes from `corehost_initialize` in `hostpolicy`. | | `Success_DifferentRuntimeProperties` | `0x00000002` | `2` | `2` | Initialization was successful, but another host context is already initialized and the requested context specified some runtime properties which are not the same (either in value or in presence) to the already initialized context. This is returned by `hostfxr_initialize_for_runtime_config` if it's called when the host is already initialized in the process. Comes from `corehost_initialize` in `hostpolicy`. | ### Failure error/exit codes | Name | Value | Value (signed, 32-bit) | Value (8-bit) | Description | | ------------------------------------- | ------------ | ---------------------- | ------------- | ----------- | | `InvalidArgFailure` | `0x80008081` | `-2147450751` | `129` | One of the specified arguments for the operation is invalid. | | `CoreHostLibLoadFailure` | `0x80008082` | `-2147450750` | `130` | There was a failure loading a dependent library. If any of the hosting components calls `LoadLibrary`/`dlopen` on a dependent library and the call fails, this error code is returned. The most common case for this failure is if the dependent library is missing some of its dependencies (for example the necessary CRT is missing on the machine), likely corrupt or incomplete install. This error code is also returned from `corehost_resolve_component_dependencies` if it's called on a `hostpolicy` which has not been initialized via the hosting layer. This would typically happen if `coreclr` is loaded directly without the hosting layer and then `AssemblyDependencyResolver` is used (which is an unsupported scenario). | | `CoreHostLibMissingFailure` | `0x80008083` | `-2147450749` | `131` | One of the dependent libraries is missing. Typically when the `hostfxr`, `hostpolicy` or `coreclr` dynamic libraries are not present in the expected locations. Probably means corrupted or incomplete installation. | | `CoreHostEntryPointFailure` | `0x80008084` | `-2147450748` | `132` | One of the dependent libraries is missing a required entry point. | | `CoreHostCurHostFindFailure` | `0x80008085` | `-2147450747` | `133` | If the hosting component is trying to use the path to the current module (the hosting component itself) and from it deduce the location of the installation. Either the location of the current module could not be determined (some weird OS call failure) or the location is not in the right place relative to other expected components. For example the `hostfxr` may look at its location and try to deduce the location of the `shared` folder with the framework from it. It assumes the typical install layout on disk. If this doesn't work, this error will be returned. | | `CoreClrResolveFailure` | `0x80008087` | `-2147450745` | `135` | If the `coreclr` library could not be found. The hosting layer (`hostpolicy`) looks for `coreclr` library either next to the app itself (for self-contained) or in the root framework (for framework-dependent). This search can be done purely by looking at disk or more commonly by looking into the respective `.deps.json`. If the `coreclr` library is missing in `.deps.json` or it's there but doesn't exist on disk, this error is returned. | | `CoreClrBindFailure` | `0x80008088` | `-2147450744` | `136` | The loaded `coreclr` library doesn't have one of the required entry points. | | `CoreClrInitFailure` | `0x80008089` | `-2147450743` | `137` | The call to `coreclr_initialize` failed. The actual error returned by `coreclr` is reported in the error message. | | `CoreClrExeFailure` | `0x8000808a` | `-2147450742` | `138` | The call to `coreclr_execute_assembly` failed. Note that this does not mean anything about the app's exit code, this failure occurs if `coreclr` failed to run the app itself. | | `ResolverInitFailure` | `0x8000808b` | `-2147450741` | `139` | Initialization of the `hostpolicy` dependency resolver failed. This can be: <ul><li> One of the frameworks or the app is missing a required `.deps.json` file. </li><li> One of the `.deps.json` files is invalid (invalid JSON, or missing required properties and so on). </li></ul> | | `ResolverResolveFailure` | `0x8000808c` | `-2147450740` | `140` | Resolution of dependencies in `hostpolicy` failed. This can mean many different things, but in general one of the processed `.deps.json` contains entry for a file which could not found, or its resolution failed for some other reason (conflict for example). | | `LibHostCurExeFindFailure` | `0x8000808d` | `-2147450739` | `141` | Failure to determine the location of the current executable. The hosting layer uses the current executable path to deduce the install location in some cases. If this path can't be obtained (OS call fails, or the returned path doesn't exist), this error is returned. | | `LibHostInitFailure` | `0x8000808e` | `-2147450738` | `142` | Initialization of the `hostpolicy` library failed. The `corehost_load` method takes a structure with lot of initialization parameters. If the version of this structure doesn't match the expected value, this error code is returned. This would in general mean incompatibility between the `hostfxr` and `hostpolicy`, which should really only happen if somehow a newer `hostpolicy` is used by older `hostfxr`. This typically means corrupted installation. | | `LibHostSdkFindFailure` | `0x80008091` | `-2147450735` | `145` | Failure to find the requested SDK. This happens in the `hostfxr` when an SDK (also called CLI) command is used with `dotnet`. In this case the hosting layer tries to find an installed .NET SDK to run the command on. The search is based on deduced install location and on the requested version from potential `global.json` file. If either no matching SDK version can be found, or that version exists, but it's missing the `dotnet.dll` file, this error code is returned. | | `LibHostInvalidArgs` | `0x80008092` | `-2147450734` | `146` | Arguments to `hostpolicy` are invalid. This is used in three unrelated places in the `hostpolicy`, but in all cases it means the component calling `hostpolicy` did something wrong: <ul><li> Command line arguments for the app - the failure would typically mean that wrong argument was passed or such. For example if the application main assembly is not specified on the command line. On its own this should not happen as `hostfxr` should have parsed and validated all command line arguments. </li><li> `hostpolicy` context's `get_delegate` - if the requested delegate enum value is not recognized. Again this would mean `hostfxr` passed the wrong value. </li><li> `corehost_resolve_component_dependencies` - if something went wrong initializing `hostpolicy` internal structures. Would happen for example when the `component_main_assembly_path` argument is wrong. </li></ul> | | `InvalidConfigFile` | `0x80008093` | `-2147450733` | `147` | The `.runtimeconfig.json` file is invalid. The reasons for this failure can be among these: <ul><li> Failure to read from the file </li><li> Invalid JSON </li><li> Invalid value for a property (for example number for property which requires a string) </li><li> Missing required property </li><li> Other inconsistencies (for example `rollForward` and `applyPatches` are not allowed to be specified in the same config file) </li><li> Any of the above failures reading the `.runtimecofig.dev.json` file </li><li> Self-contained `.runtimeconfig.json` used in `hostfxr_initialize_for_runtime_config`. Note that missing `.runtimconfig.json` is not an error (means self-contained app). This error code is also used when there is a problem reading the CLSID map file in `comhost`. </li></ul> | | `AppArgNotRunnable` | `0x80008094` | `-2147450732` | `148` | Used internally when the command line for `dotnet.exe` doesn't contain path to the application to run. In such case the command line is considered to be a CLI/SDK command. This error code should never be returned to external caller. | | `AppHostExeNotBoundFailure` | `0x80008095` | `-2147450731` | `149` | `apphost` failed to determine which application to run. This can mean: <ul><li> The `apphost` binary has not been imprinted with the path to the app to run (so freshly built `apphost.exe` from the branch will fail to run like this) </li><li> The `apphost` is a bundle (single-file exe) and it failed to extract correctly. </li></ul> | | `FrameworkMissingFailure` | `0x80008096` | `-2147450730` | `150` | It was not possible to find a compatible framework version. This originates in `hostfxr` (`resolve_framework_reference`) and means that the app specified a reference to a framework in its `.runtimeconfig.json` which could not be resolved. The failure to resolve can mean that no such framework is available on the disk, or that the available frameworks don't match the minimum version specified or that the roll forward options specified excluded all available frameworks. Typically this would be used if a 3.0 app is trying to run on a machine which has no 3.0 installed. It would also be used for example if a 32bit 3.0 app is running on a machine which has 3.0 installed but only for 64bit. | | `HostApiFailed` | `0x80008097` | `-2147450729` | `151` | Returned by `hostfxr_get_native_search_directories` if the `hostpolicy` could not calculate the `NATIVE_DLL_SEARCH_DIRECTORIES`. | | `HostApiBufferTooSmall` | `0x80008098` | `-2147450728` | `152` | Returned when the buffer specified to an API is not big enough to fit the requested value. Can be returned from: <ul><li> `hostfxr_get_runtime_properties` </li><li> `hostfxr_get_native_search_directories` </li><li> `get_hostfxr_path` </li></ul> | | `LibHostUnknownCommand` | `0x80008099` | `-2147450727` | `153` | Returned by `hostpolicy` if the `corehost_main_with_output_buffer` is called with unsupported host command. This error code means there is incompatibility between the `hostfxr` and `hostpolicy`. In reality this should pretty much never happen. | | `LibHostAppRootFindFailure` | `0x8000809a` | `-2147450726` | `154` | Returned by `apphost` if the imprinted application path doesn't exist. This would happen if the app is built with an executable (the `apphost`) and the main `app.dll` is missing. | | `SdkResolverResolveFailure` | `0x8000809b` | `-2147450725` | `155` | Returned from `hostfxr_resolve_sdk2` when it fails to find matching SDK. Similar to `LibHostSdkFindFailure` but only used in the `hostfxr_resolve_sdk2`. | | `FrameworkCompatFailure` | `0x8000809c` | `-2147450724` | `156` | During processing of `.runtimeconfig.json` there were two framework references to the same framework which were not compatible. This can happen if the app specified a framework reference to a lower-level framework which is also specified by a higher-level framework which is also used by the app. For example, this would happen if the app referenced `Microsoft.AspNet.App` version 2.0 and `Microsoft.NETCore.App` version 3.0. In such case the `Microsoft.AspNet.App` has `.runtimeconfig.json` which also references `Microsoft.NETCore.App` but it only allows versions 2.0 up to 2.9 (via roll forward options). So the version 3.0 requested by the app is incompatible. | | `FrameworkCompatRetry` | `0x8000809d` | `-2147450723` | `157` | Error used internally if the processing of framework references from `.runtimeconfig.json` reached a point where it needs to reprocess another already processed framework reference. If this error is returned to the external caller, it would mean there's a bug in the framework resolution algorithm. | | `AppHostExeNotBundle` | `0x8000809e` | `-2147450722` | `158` | Error reading the bundle footer metadata from a single-file `apphost`. This would mean a corrupted `apphost`. | | `BundleExtractionFailure` | `0x8000809f` | `-2147450721` | `159` | Error extracting single-file `apphost` bundle. This is used in case of any error related to the bundle itself. Typically would mean a corrupted bundle. | | `BundleExtractionIOError` | `0x800080a0` | `-2147450720` | `160` | Error reading or writing files during single-file `apphost` bundle extraction. | | `LibHostDuplicateProperty` | `0x800080a1` | `-2147450719` | `161` | The `.runtimeconfig.json` specified by the app contains a runtime property which is also produced by the hosting layer. For example if the `.runtimeconfig.json` would specify a property `TRUSTED_PLATFORM_ROOTS`, this error code would be returned. It is not allowed to specify properties which are otherwise populated by the hosting layer (`hostpolicy`) as there is not good way to resolve such conflicts. | | `HostApiUnsupportedVersion` | `0x800080a2` | `-2147450718` | `162` | Feature which requires certain version of the hosting layer binaries was used on a version which doesn't support it. For example if COM component specified to run on 2.0 `Microsoft.NETCore.App` - as that contains older version of `hostpolicy` which doesn't support the necessary features to provide COM services. | | `HostInvalidState` | `0x800080a3` | `-2147450717` | `163` | Error code returned by the hosting APIs in `hostfxr` if the current state is incompatible with the requested operation. There are many such cases, please refer to the documentation of the hosting APIs for details. For example if `hostfxr_get_runtime_property_value` is called with the `host_context_handle` `nullptr` (meaning get property from the active runtime) but there's no active runtime in the process. | | `HostPropertyNotFound` | `0x800080a4` | `-2147450716` | `164` | property requested by `hostfxr_get_runtime_property_value` doesn't exist. | | `CoreHostIncompatibleConfig` | `0x800080a5` | `-2147450715` | `165` | Error returned by `hostfxr_initialize_for_runtime_config` if the component being initialized requires framework which is not available or incompatible with the frameworks loaded by the runtime already in the process. For example trying to load a component which requires 3.0 into a process which is already running a 2.0 runtime. | | `HostApiUnsupportedScenario` | `0x800080a6` | `-2147450714` | `166` | Error returned by `hostfxr_get_runtime_delegate` when `hostfxr` doesn't currently support requesting the given delegate type using the given context. | | `HostFeatureDisabled` | `0x800080a7` | `-2147450713` | `167` | Error returned by `hostfxr_get_runtime_delegate` when managed feature support for native host is disabled. |
# Hosting layer error and exit codes This document lists all the values returned as special exit codes when running `dotnet.exe` or `apphost` or returned by the hosting APIs (`hostfxr`, `hostpolicy` and `nethost`). Those exit codes are also specified in signed 32-bit form (what you would see if you run `echo %ERRORLEVEL%` on Winodws) and in 8-bit form (what you would see if you run `echo $?` on Linux). Note that the exit code returned by running an application via `dotnet.exe` or `apphost` can either be one of the below values or the exit code of the managed application itself. ### Success error/exit codes | Name | Value | Value (signed, 32-bit) | Value (8-bit) | Description | | ------------------------------------- | ------------ | ---------------------- | ------------- | ----------- | | `Success` | `0x00000000` | `0` | `0` | Operation was successful. | | `Success_HostAlreadyInitialized` | `0x00000001` | `1` | `1` | Initialization was successful, but another host context is already initialized, so the returned context is "secondary". The requested context was otherwise fully compatible with the already initialized context. This is returned by `hostfxr_initialize_for_runtime_config` if it's called when the host is already initialized in the process. Comes from `corehost_initialize` in `hostpolicy`. | | `Success_DifferentRuntimeProperties` | `0x00000002` | `2` | `2` | Initialization was successful, but another host context is already initialized and the requested context specified some runtime properties which are not the same (either in value or in presence) to the already initialized context. This is returned by `hostfxr_initialize_for_runtime_config` if it's called when the host is already initialized in the process. Comes from `corehost_initialize` in `hostpolicy`. | ### Failure error/exit codes | Name | Value | Value (signed, 32-bit) | Value (8-bit) | Description | | ------------------------------------- | ------------ | ---------------------- | ------------- | ----------- | | `InvalidArgFailure` | `0x80008081` | `-2147450751` | `129` | One of the specified arguments for the operation is invalid. | | `CoreHostLibLoadFailure` | `0x80008082` | `-2147450750` | `130` | There was a failure loading a dependent library. If any of the hosting components calls `LoadLibrary`/`dlopen` on a dependent library and the call fails, this error code is returned. The most common case for this failure is if the dependent library is missing some of its dependencies (for example the necessary CRT is missing on the machine), likely corrupt or incomplete install. This error code is also returned from `corehost_resolve_component_dependencies` if it's called on a `hostpolicy` which has not been initialized via the hosting layer. This would typically happen if `coreclr` is loaded directly without the hosting layer and then `AssemblyDependencyResolver` is used (which is an unsupported scenario). | | `CoreHostLibMissingFailure` | `0x80008083` | `-2147450749` | `131` | One of the dependent libraries is missing. Typically when the `hostfxr`, `hostpolicy` or `coreclr` dynamic libraries are not present in the expected locations. Probably means corrupted or incomplete installation. | | `CoreHostEntryPointFailure` | `0x80008084` | `-2147450748` | `132` | One of the dependent libraries is missing a required entry point. | | `CoreHostCurHostFindFailure` | `0x80008085` | `-2147450747` | `133` | If the hosting component is trying to use the path to the current module (the hosting component itself) and from it deduce the location of the installation. Either the location of the current module could not be determined (some weird OS call failure) or the location is not in the right place relative to other expected components. For example the `hostfxr` may look at its location and try to deduce the location of the `shared` folder with the framework from it. It assumes the typical install layout on disk. If this doesn't work, this error will be returned. | | `CoreClrResolveFailure` | `0x80008087` | `-2147450745` | `135` | If the `coreclr` library could not be found. The hosting layer (`hostpolicy`) looks for `coreclr` library either next to the app itself (for self-contained) or in the root framework (for framework-dependent). This search can be done purely by looking at disk or more commonly by looking into the respective `.deps.json`. If the `coreclr` library is missing in `.deps.json` or it's there but doesn't exist on disk, this error is returned. | | `CoreClrBindFailure` | `0x80008088` | `-2147450744` | `136` | The loaded `coreclr` library doesn't have one of the required entry points. | | `CoreClrInitFailure` | `0x80008089` | `-2147450743` | `137` | The call to `coreclr_initialize` failed. The actual error returned by `coreclr` is reported in the error message. | | `CoreClrExeFailure` | `0x8000808a` | `-2147450742` | `138` | The call to `coreclr_execute_assembly` failed. Note that this does not mean anything about the app's exit code, this failure occurs if `coreclr` failed to run the app itself. | | `ResolverInitFailure` | `0x8000808b` | `-2147450741` | `139` | Initialization of the `hostpolicy` dependency resolver failed. This can be: <ul><li> One of the frameworks or the app is missing a required `.deps.json` file. </li><li> One of the `.deps.json` files is invalid (invalid JSON, or missing required properties and so on). </li></ul> | | `ResolverResolveFailure` | `0x8000808c` | `-2147450740` | `140` | Resolution of dependencies in `hostpolicy` failed. This can mean many different things, but in general one of the processed `.deps.json` contains entry for a file which could not found, or its resolution failed for some other reason (conflict for example). | | `LibHostCurExeFindFailure` | `0x8000808d` | `-2147450739` | `141` | Failure to determine the location of the current executable. The hosting layer uses the current executable path to deduce the install location in some cases. If this path can't be obtained (OS call fails, or the returned path doesn't exist), this error is returned. | | `LibHostInitFailure` | `0x8000808e` | `-2147450738` | `142` | Initialization of the `hostpolicy` library failed. The `corehost_load` method takes a structure with lot of initialization parameters. If the version of this structure doesn't match the expected value, this error code is returned. This would in general mean incompatibility between the `hostfxr` and `hostpolicy`, which should really only happen if somehow a newer `hostpolicy` is used by older `hostfxr`. This typically means corrupted installation. | | `LibHostSdkFindFailure` | `0x80008091` | `-2147450735` | `145` | Failure to find the requested SDK. This happens in the `hostfxr` when an SDK (also called CLI) command is used with `dotnet`. In this case the hosting layer tries to find an installed .NET SDK to run the command on. The search is based on deduced install location and on the requested version from potential `global.json` file. If either no matching SDK version can be found, or that version exists, but it's missing the `dotnet.dll` file, this error code is returned. | | `LibHostInvalidArgs` | `0x80008092` | `-2147450734` | `146` | Arguments to `hostpolicy` are invalid. This is used in three unrelated places in the `hostpolicy`, but in all cases it means the component calling `hostpolicy` did something wrong: <ul><li> Command line arguments for the app - the failure would typically mean that wrong argument was passed or such. For example if the application main assembly is not specified on the command line. On its own this should not happen as `hostfxr` should have parsed and validated all command line arguments. </li><li> `hostpolicy` context's `get_delegate` - if the requested delegate enum value is not recognized. Again this would mean `hostfxr` passed the wrong value. </li><li> `corehost_resolve_component_dependencies` - if something went wrong initializing `hostpolicy` internal structures. Would happen for example when the `component_main_assembly_path` argument is wrong. </li></ul> | | `InvalidConfigFile` | `0x80008093` | `-2147450733` | `147` | The `.runtimeconfig.json` file is invalid. The reasons for this failure can be among these: <ul><li> Failure to read from the file </li><li> Invalid JSON </li><li> Invalid value for a property (for example number for property which requires a string) </li><li> Missing required property </li><li> Other inconsistencies (for example `rollForward` and `applyPatches` are not allowed to be specified in the same config file) </li><li> Any of the above failures reading the `.runtimecofig.dev.json` file </li><li> Self-contained `.runtimeconfig.json` used in `hostfxr_initialize_for_runtime_config`. Note that missing `.runtimconfig.json` is not an error (means self-contained app). This error code is also used when there is a problem reading the CLSID map file in `comhost`. </li></ul> | | `AppArgNotRunnable` | `0x80008094` | `-2147450732` | `148` | Used internally when the command line for `dotnet.exe` doesn't contain path to the application to run. In such case the command line is considered to be a CLI/SDK command. This error code should never be returned to external caller. | | `AppHostExeNotBoundFailure` | `0x80008095` | `-2147450731` | `149` | `apphost` failed to determine which application to run. This can mean: <ul><li> The `apphost` binary has not been imprinted with the path to the app to run (so freshly built `apphost.exe` from the branch will fail to run like this) </li><li> The `apphost` is a bundle (single-file exe) and it failed to extract correctly. </li></ul> | | `FrameworkMissingFailure` | `0x80008096` | `-2147450730` | `150` | It was not possible to find a compatible framework version. This originates in `hostfxr` (`resolve_framework_reference`) and means that the app specified a reference to a framework in its `.runtimeconfig.json` which could not be resolved. The failure to resolve can mean that no such framework is available on the disk, or that the available frameworks don't match the minimum version specified or that the roll forward options specified excluded all available frameworks. Typically this would be used if a 3.0 app is trying to run on a machine which has no 3.0 installed. It would also be used for example if a 32bit 3.0 app is running on a machine which has 3.0 installed but only for 64bit. | | `HostApiFailed` | `0x80008097` | `-2147450729` | `151` | Returned by `hostfxr_get_native_search_directories` if the `hostpolicy` could not calculate the `NATIVE_DLL_SEARCH_DIRECTORIES`. | | `HostApiBufferTooSmall` | `0x80008098` | `-2147450728` | `152` | Returned when the buffer specified to an API is not big enough to fit the requested value. Can be returned from: <ul><li> `hostfxr_get_runtime_properties` </li><li> `hostfxr_get_native_search_directories` </li><li> `get_hostfxr_path` </li></ul> | | `LibHostUnknownCommand` | `0x80008099` | `-2147450727` | `153` | Returned by `hostpolicy` if the `corehost_main_with_output_buffer` is called with unsupported host command. This error code means there is incompatibility between the `hostfxr` and `hostpolicy`. In reality this should pretty much never happen. | | `LibHostAppRootFindFailure` | `0x8000809a` | `-2147450726` | `154` | Returned by `apphost` if the imprinted application path doesn't exist. This would happen if the app is built with an executable (the `apphost`) and the main `app.dll` is missing. | | `SdkResolverResolveFailure` | `0x8000809b` | `-2147450725` | `155` | Returned from `hostfxr_resolve_sdk2` when it fails to find matching SDK. Similar to `LibHostSdkFindFailure` but only used in the `hostfxr_resolve_sdk2`. | | `FrameworkCompatFailure` | `0x8000809c` | `-2147450724` | `156` | During processing of `.runtimeconfig.json` there were two framework references to the same framework which were not compatible. This can happen if the app specified a framework reference to a lower-level framework which is also specified by a higher-level framework which is also used by the app. For example, this would happen if the app referenced `Microsoft.AspNet.App` version 2.0 and `Microsoft.NETCore.App` version 3.0. In such case the `Microsoft.AspNet.App` has `.runtimeconfig.json` which also references `Microsoft.NETCore.App` but it only allows versions 2.0 up to 2.9 (via roll forward options). So the version 3.0 requested by the app is incompatible. | | `FrameworkCompatRetry` | `0x8000809d` | `-2147450723` | `157` | Error used internally if the processing of framework references from `.runtimeconfig.json` reached a point where it needs to reprocess another already processed framework reference. If this error is returned to the external caller, it would mean there's a bug in the framework resolution algorithm. | | `AppHostExeNotBundle` | `0x8000809e` | `-2147450722` | `158` | Error reading the bundle footer metadata from a single-file `apphost`. This would mean a corrupted `apphost`. | | `BundleExtractionFailure` | `0x8000809f` | `-2147450721` | `159` | Error extracting single-file `apphost` bundle. This is used in case of any error related to the bundle itself. Typically would mean a corrupted bundle. | | `BundleExtractionIOError` | `0x800080a0` | `-2147450720` | `160` | Error reading or writing files during single-file `apphost` bundle extraction. | | `LibHostDuplicateProperty` | `0x800080a1` | `-2147450719` | `161` | The `.runtimeconfig.json` specified by the app contains a runtime property which is also produced by the hosting layer. For example if the `.runtimeconfig.json` would specify a property `TRUSTED_PLATFORM_ROOTS`, this error code would be returned. It is not allowed to specify properties which are otherwise populated by the hosting layer (`hostpolicy`) as there is not good way to resolve such conflicts. | | `HostApiUnsupportedVersion` | `0x800080a2` | `-2147450718` | `162` | Feature which requires certain version of the hosting layer binaries was used on a version which doesn't support it. For example if COM component specified to run on 2.0 `Microsoft.NETCore.App` - as that contains older version of `hostpolicy` which doesn't support the necessary features to provide COM services. | | `HostInvalidState` | `0x800080a3` | `-2147450717` | `163` | Error code returned by the hosting APIs in `hostfxr` if the current state is incompatible with the requested operation. There are many such cases, please refer to the documentation of the hosting APIs for details. For example if `hostfxr_get_runtime_property_value` is called with the `host_context_handle` `nullptr` (meaning get property from the active runtime) but there's no active runtime in the process. | | `HostPropertyNotFound` | `0x800080a4` | `-2147450716` | `164` | property requested by `hostfxr_get_runtime_property_value` doesn't exist. | | `CoreHostIncompatibleConfig` | `0x800080a5` | `-2147450715` | `165` | Error returned by `hostfxr_initialize_for_runtime_config` if the component being initialized requires framework which is not available or incompatible with the frameworks loaded by the runtime already in the process. For example trying to load a component which requires 3.0 into a process which is already running a 2.0 runtime. | | `HostApiUnsupportedScenario` | `0x800080a6` | `-2147450714` | `166` | Error returned by `hostfxr_get_runtime_delegate` when `hostfxr` doesn't currently support requesting the given delegate type using the given context. | | `HostFeatureDisabled` | `0x800080a7` | `-2147450713` | `167` | Error returned by `hostfxr_get_runtime_delegate` when managed feature support for native host is disabled. |
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Net.Http.Json/ref/System.Net.Http.Json.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // ------------------------------------------------------------------------------ // Changes to this file must follow the https://aka.ms/api-review process. // ------------------------------------------------------------------------------ namespace System.Net.Http.Json { public static partial class HttpClientJsonExtensions { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } } public static partial class HttpContentJsonExtensions { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, System.Type type, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public sealed partial class JsonContent : System.Net.Http.HttpContent { internal JsonContent() { } public System.Type ObjectType { get { throw null; } } public object? Value { get { throw null; } } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Net.Http.Json.JsonContent Create(object? inputValue, System.Type inputType, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = null, System.Text.Json.JsonSerializerOptions? options = null) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = null, System.Text.Json.JsonSerializerOptions? options = null) { throw null; } protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context) { throw null; } protected override bool TryComputeLength(out long length) { throw null; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // ------------------------------------------------------------------------------ // Changes to this file must follow the https://aka.ms/api-review process. // ------------------------------------------------------------------------------ namespace System.Net.Http.Json { public static partial class HttpClientJsonExtensions { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PatchAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; } } public static partial class HttpContentJsonExtensions { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, System.Type type, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, System.Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public sealed partial class JsonContent : System.Net.Http.HttpContent { internal JsonContent() { } public System.Type ObjectType { get { throw null; } } public object? Value { get { throw null; } } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Net.Http.Json.JsonContent Create(object? inputValue, System.Type inputType, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = null, System.Text.Json.JsonSerializerOptions? options = null) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = null, System.Text.Json.JsonSerializerOptions? options = null) { throw null; } protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context) { throw null; } protected override bool TryComputeLength(out long length) { throw null; } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/X86/Sse42/Program.Sse42.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { static Program() { TestList = new Dictionary<string, Action>() { ["CompareGreaterThan.Int64"] = CompareGreaterThanInt64, }; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { static Program() { TestList = new Dictionary<string, Action>() { ["CompareGreaterThan.Int64"] = CompareGreaterThanInt64, }; } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/Loader/classloader/generics/GenericMethods/method004.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="method004.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="method004.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/ConvertToUInt64.Double.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ConvertToUInt64Double() { var test = new VectorUnaryOpTest__ConvertToUInt64Double(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorUnaryOpTest__ConvertToUInt64Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__ConvertToUInt64Double testClass) { var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector128<Double> _clsVar1; private Vector128<Double> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__ConvertToUInt64Double() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public VectorUnaryOpTest__ConvertToUInt64Double() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, new UInt64[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.ConvertToUInt64( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), new Type[] { typeof(Vector128<Double>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt64)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.ConvertToUInt64( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var result = Vector128.ConvertToUInt64(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__ConvertToUInt64Double(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (ulong)(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (ulong)(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.ConvertToUInt64)}<UInt64>(Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ConvertToUInt64Double() { var test = new VectorUnaryOpTest__ConvertToUInt64Double(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorUnaryOpTest__ConvertToUInt64Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__ConvertToUInt64Double testClass) { var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector128<Double> _clsVar1; private Vector128<Double> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__ConvertToUInt64Double() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public VectorUnaryOpTest__ConvertToUInt64Double() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, new UInt64[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.ConvertToUInt64( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), new Type[] { typeof(Vector128<Double>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt64)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.ConvertToUInt64( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var result = Vector128.ConvertToUInt64(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__ConvertToUInt64Double(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (ulong)(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (ulong)(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.ConvertToUInt64)}<UInt64>(Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/libraries/System.Runtime.Extensions/tests/System/Convert.ToHexString.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; using System.Text; using System.Collections.Generic; namespace System.Tests { public class ConvertToHexStringTests { [Fact] public static void KnownByteSequence() { byte[] inputBytes = new byte[] { 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF }; Assert.Equal("000102FDFEFF", Convert.ToHexString(inputBytes)); } [Fact] public static void CompleteValueRange() { byte[] values = new byte[256]; StringBuilder sb = new StringBuilder(256); for (int i = 0; i < values.Length; i++) { values[i] = (byte)i; sb.Append($"{i:X2}"); } Assert.Equal(sb.ToString(), Convert.ToHexString(values)); } [Fact] public static void ZeroLength() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); Assert.Same(string.Empty, Convert.ToHexString(inputBytes, 0, 0)); } [Fact] public static void InvalidInputBuffer() { AssertExtensions.Throws<ArgumentNullException>("inArray", () => Convert.ToHexString(null)); AssertExtensions.Throws<ArgumentNullException>("inArray", () => Convert.ToHexString(null, 0, 0)); } [Fact] public static void InvalidOffset() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, -1, inputBytes.Length)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, inputBytes.Length, inputBytes.Length)); } [Fact] public static void InvalidLength() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); AssertExtensions.Throws<ArgumentOutOfRangeException>("length", () => Convert.ToHexString(inputBytes, 0, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, 0, inputBytes.Length + 1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, 1, inputBytes.Length)); } [Fact] public static unsafe void InputTooLarge() { AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => Convert.ToHexString(new ReadOnlySpan<byte>((void*)0, Int32.MaxValue))); } public static IEnumerable<object[]> ToHexStringTestData() { yield return new object[] { new byte[0], "" }; yield return new object[] { new byte[] { 0x00 }, "00" }; yield return new object[] { new byte[] { 0x01 }, "01" }; yield return new object[] { new byte[] { 0xFF }, "FF" }; yield return new object[] { new byte[] { 0x00, 0x00 }, "0000" }; yield return new object[] { new byte[] { 0xAB, 0xCD }, "ABCD" }; yield return new object[] { new byte[] { 0xFF, 0xFF }, "FFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00 }, "000000" }; yield return new object[] { new byte[] { 0x01, 0x02, 0x03 }, "010203" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF }, "FFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00 }, "00000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12 }, "ABCDEF12" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00 }, "0000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34 }, "ABCDEF1234" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56 }, "ABCDEF123456" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "00000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56, 0x78 }, "ABCDEF12345678" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "0000000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56, 0x78, 0x90 }, "ABCDEF1234567890" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "000000000000000000" }; yield return new object[] { new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }, "010203040506070809" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFFFFFF" }; } [Theory] [MemberData(nameof(ToHexStringTestData))] public static unsafe void ToHexString(byte[] input, string expected) { string actual = Convert.ToHexString(input); Assert.Equal(expected, actual); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; using System.Text; using System.Collections.Generic; namespace System.Tests { public class ConvertToHexStringTests { [Fact] public static void KnownByteSequence() { byte[] inputBytes = new byte[] { 0x00, 0x01, 0x02, 0xFD, 0xFE, 0xFF }; Assert.Equal("000102FDFEFF", Convert.ToHexString(inputBytes)); } [Fact] public static void CompleteValueRange() { byte[] values = new byte[256]; StringBuilder sb = new StringBuilder(256); for (int i = 0; i < values.Length; i++) { values[i] = (byte)i; sb.Append($"{i:X2}"); } Assert.Equal(sb.ToString(), Convert.ToHexString(values)); } [Fact] public static void ZeroLength() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); Assert.Same(string.Empty, Convert.ToHexString(inputBytes, 0, 0)); } [Fact] public static void InvalidInputBuffer() { AssertExtensions.Throws<ArgumentNullException>("inArray", () => Convert.ToHexString(null)); AssertExtensions.Throws<ArgumentNullException>("inArray", () => Convert.ToHexString(null, 0, 0)); } [Fact] public static void InvalidOffset() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, -1, inputBytes.Length)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, inputBytes.Length, inputBytes.Length)); } [Fact] public static void InvalidLength() { byte[] inputBytes = Convert.FromHexString("000102FDFEFF"); AssertExtensions.Throws<ArgumentOutOfRangeException>("length", () => Convert.ToHexString(inputBytes, 0, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, 0, inputBytes.Length + 1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("offset", () => Convert.ToHexString(inputBytes, 1, inputBytes.Length)); } [Fact] public static unsafe void InputTooLarge() { AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => Convert.ToHexString(new ReadOnlySpan<byte>((void*)0, Int32.MaxValue))); } public static IEnumerable<object[]> ToHexStringTestData() { yield return new object[] { new byte[0], "" }; yield return new object[] { new byte[] { 0x00 }, "00" }; yield return new object[] { new byte[] { 0x01 }, "01" }; yield return new object[] { new byte[] { 0xFF }, "FF" }; yield return new object[] { new byte[] { 0x00, 0x00 }, "0000" }; yield return new object[] { new byte[] { 0xAB, 0xCD }, "ABCD" }; yield return new object[] { new byte[] { 0xFF, 0xFF }, "FFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00 }, "000000" }; yield return new object[] { new byte[] { 0x01, 0x02, 0x03 }, "010203" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF }, "FFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00 }, "00000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12 }, "ABCDEF12" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00 }, "0000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34 }, "ABCDEF1234" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56 }, "ABCDEF123456" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "00000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56, 0x78 }, "ABCDEF12345678" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "0000000000000000" }; yield return new object[] { new byte[] { 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56, 0x78, 0x90 }, "ABCDEF1234567890" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFFFF" }; yield return new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, "000000000000000000" }; yield return new object[] { new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }, "010203040506070809" }; yield return new object[] { new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, "FFFFFFFFFFFFFFFFFF" }; } [Theory] [MemberData(nameof(ToHexStringTestData))] public static unsafe void ToHexString(byte[] input, string expected) { string actual = Convert.ToHexString(input); Assert.Equal(expected, actual); } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/DuplicateSelectedScalarToVector128.Vector64.SByte.1.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void DuplicateSelectedScalarToVector128_Vector64_SByte_1() { var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 { private struct DataTable { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray, SByte[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<SByte, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<SByte> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 testClass) { var result = AdvSimd.DuplicateSelectedScalarToVector128(_fld, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 testClass) { fixed (Vector64<SByte>* pFld = &_fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly byte Imm = 1; private static SByte[] _data = new SByte[Op1ElementCount]; private static Vector64<SByte> _clsVar; private Vector64<SByte> _fld; private DataTable _dataTable; static ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data, new SByte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.DuplicateSelectedScalarToVector128( Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.DuplicateSelectedScalarToVector128), new Type[] { typeof(Vector64<SByte>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.DuplicateSelectedScalarToVector128), new Type[] { typeof(Vector64<SByte>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.DuplicateSelectedScalarToVector128( _clsVar, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar = &_clsVar) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pClsVar)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr); var result = AdvSimd.DuplicateSelectedScalarToVector128(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)); var result = AdvSimd.DuplicateSelectedScalarToVector128(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); var result = AdvSimd.DuplicateSelectedScalarToVector128(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); fixed (Vector64<SByte>* pFld = &test._fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.DuplicateSelectedScalarToVector128(_fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld = &_fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.DuplicateSelectedScalarToVector128(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(&test._fld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<SByte> firstOp, void* result, [CallerMemberName] string method = "") { SByte[] inArray = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { SByte[] inArray = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (firstOp[Imm] != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.DuplicateSelectedScalarToVector128)}<SByte>(Vector64<SByte>, 1): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void DuplicateSelectedScalarToVector128_Vector64_SByte_1() { var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 { private struct DataTable { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray, SByte[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<SByte, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<SByte> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 testClass) { var result = AdvSimd.DuplicateSelectedScalarToVector128(_fld, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1 testClass) { fixed (Vector64<SByte>* pFld = &_fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly byte Imm = 1; private static SByte[] _data = new SByte[Op1ElementCount]; private static Vector64<SByte> _clsVar; private Vector64<SByte> _fld; private DataTable _dataTable; static ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data, new SByte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.DuplicateSelectedScalarToVector128( Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.DuplicateSelectedScalarToVector128), new Type[] { typeof(Vector64<SByte>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.DuplicateSelectedScalarToVector128), new Type[] { typeof(Vector64<SByte>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.DuplicateSelectedScalarToVector128( _clsVar, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar = &_clsVar) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pClsVar)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector64<SByte>>(_dataTable.inArrayPtr); var result = AdvSimd.DuplicateSelectedScalarToVector128(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = AdvSimd.LoadVector64((SByte*)(_dataTable.inArrayPtr)); var result = AdvSimd.DuplicateSelectedScalarToVector128(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); var result = AdvSimd.DuplicateSelectedScalarToVector128(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new ImmUnaryOpTest__DuplicateSelectedScalarToVector128_Vector64_SByte_1(); fixed (Vector64<SByte>* pFld = &test._fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.DuplicateSelectedScalarToVector128(_fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld = &_fld) { var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.DuplicateSelectedScalarToVector128(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.DuplicateSelectedScalarToVector128( AdvSimd.LoadVector64((SByte*)(&test._fld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<SByte> firstOp, void* result, [CallerMemberName] string method = "") { SByte[] inArray = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { SByte[] inArray = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (firstOp[Imm] != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.DuplicateSelectedScalarToVector128)}<SByte>(Vector64<SByte>, 1): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/coreclr/tools/Common/Internal/Metadata/NativeFormat/MdBinaryReaderGen.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // NOTE: This is a generated file - do not manually edit! #pragma warning disable 649 using System; using System.IO; using System.Collections.Generic; using System.Reflection; using Internal.NativeFormat; using Debug = System.Diagnostics.Debug; namespace Internal.Metadata.NativeFormat { internal static partial class MdBinaryReader { public static unsafe uint Read(this NativeReader reader, uint offset, out BooleanCollection values) { values = new BooleanCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(bool)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out CharCollection values) { values = new CharCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(char)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out ByteCollection values) { values = new ByteCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(byte)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out SByteCollection values) { values = new SByteCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(sbyte)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int16Collection values) { values = new Int16Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(short)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt16Collection values) { values = new UInt16Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(ushort)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int32Collection values) { values = new Int32Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(int)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt32Collection values) { values = new UInt32Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(uint)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int64Collection values) { values = new Int64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(long)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt64Collection values) { values = new UInt64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(ulong)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out SingleCollection values) { values = new SingleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(float)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out DoubleCollection values) { values = new DoubleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(double)); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out AssemblyFlags value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (AssemblyFlags)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out AssemblyHashAlgorithm value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (AssemblyHashAlgorithm)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CallingConventions value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (CallingConventions)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (EventAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (FieldAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (GenericParameterAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterKind value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (GenericParameterKind)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodImplAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodImplAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodSemanticsAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentMemberKind value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (NamedArgumentMemberKind)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (ParameterAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PInvokeAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (PInvokeAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (PropertyAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (TypeAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out HandleCollection values) { values = new HandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ArraySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ArraySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ByReferenceSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ByReferenceSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBooleanArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBooleanArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBooleanValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBooleanValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBoxedEnumValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBoxedEnumValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantByteArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantByteArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantByteValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantByteValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantCharArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantCharArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantCharValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantCharValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantDoubleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantDoubleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantDoubleValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantDoubleValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantEnumArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantEnumArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantHandleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantHandleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt16ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt16ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt16ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt16ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt32ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt32ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt32ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt32ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt64ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt64ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt64ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt64ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantReferenceValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantReferenceValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSByteArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSByteArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSByteValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSByteValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSingleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSingleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSingleValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSingleValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantStringArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantStringArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantStringValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantStringValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt16ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt16ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt16ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt16ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt32ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt32ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt32ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt32ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt64ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt64ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt64ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt64ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new CustomAttributeHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new EventHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FieldHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FieldSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FunctionPointerSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FunctionPointerSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new GenericParameterHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MemberReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MemberReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodInstantiationHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodInstantiationHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodSemanticsHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodTypeVariableSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodTypeVariableSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ModifiedTypeHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ModifiedTypeHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamedArgumentHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamespaceDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamespaceReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ParameterHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PointerSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PointerSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PropertyHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PropertySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out QualifiedFieldHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new QualifiedFieldHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out QualifiedMethodHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new QualifiedMethodHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out SZArraySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new SZArraySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ScopeDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ScopeReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeForwarderHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeInstantiationSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeInstantiationSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeSpecificationHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeSpecificationHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeVariableSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeVariableSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentHandleCollection values) { values = new NamedArgumentHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsHandleCollection values) { values = new MethodSemanticsHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandleCollection values) { values = new CustomAttributeHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterHandleCollection values) { values = new ParameterHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterHandleCollection values) { values = new GenericParameterHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeDefinitionHandleCollection values) { values = new TypeDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandleCollection values) { values = new TypeForwarderHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceDefinitionHandleCollection values) { values = new NamespaceDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodHandleCollection values) { values = new MethodHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldHandleCollection values) { values = new FieldHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandleCollection values) { values = new PropertyHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventHandleCollection values) { values = new EventHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeDefinitionHandleCollection values) { values = new ScopeDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read } // MdBinaryReader } // Internal.Metadata.NativeFormat
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // NOTE: This is a generated file - do not manually edit! #pragma warning disable 649 using System; using System.IO; using System.Collections.Generic; using System.Reflection; using Internal.NativeFormat; using Debug = System.Diagnostics.Debug; namespace Internal.Metadata.NativeFormat { internal static partial class MdBinaryReader { public static unsafe uint Read(this NativeReader reader, uint offset, out BooleanCollection values) { values = new BooleanCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(bool)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out CharCollection values) { values = new CharCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(char)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out ByteCollection values) { values = new ByteCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(byte)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out SByteCollection values) { values = new SByteCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(sbyte)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int16Collection values) { values = new Int16Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(short)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt16Collection values) { values = new UInt16Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(ushort)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int32Collection values) { values = new Int32Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(int)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt32Collection values) { values = new UInt32Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(uint)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int64Collection values) { values = new Int64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(long)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt64Collection values) { values = new UInt64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(ulong)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out SingleCollection values) { values = new SingleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(float)); return offset; } // Read public static unsafe uint Read(this NativeReader reader, uint offset, out DoubleCollection values) { values = new DoubleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(double)); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out AssemblyFlags value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (AssemblyFlags)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out AssemblyHashAlgorithm value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (AssemblyHashAlgorithm)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CallingConventions value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (CallingConventions)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (EventAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (FieldAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (GenericParameterAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterKind value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (GenericParameterKind)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodImplAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodImplAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (MethodSemanticsAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentMemberKind value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (NamedArgumentMemberKind)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (ParameterAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PInvokeAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (PInvokeAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (PropertyAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeAttributes value) { uint ivalue; offset = reader.DecodeUnsigned(offset, out ivalue); value = (TypeAttributes)ivalue; return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out HandleCollection values) { values = new HandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ArraySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ArraySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ByReferenceSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ByReferenceSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBooleanArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBooleanArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBooleanValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBooleanValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantBoxedEnumValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantBoxedEnumValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantByteArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantByteArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantByteValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantByteValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantCharArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantCharArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantCharValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantCharValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantDoubleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantDoubleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantDoubleValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantDoubleValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantEnumArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantEnumArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantHandleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantHandleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt16ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt16ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt16ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt16ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt32ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt32ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt32ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt32ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt64ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt64ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantInt64ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantInt64ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantReferenceValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantReferenceValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSByteArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSByteArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSByteValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSByteValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSingleArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSingleArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantSingleValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantSingleValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantStringArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantStringArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantStringValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantStringValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt16ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt16ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt16ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt16ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt32ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt32ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt32ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt32ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt64ArrayHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt64ArrayHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ConstantUInt64ValueHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ConstantUInt64ValueHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new CustomAttributeHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new EventHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FieldHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FieldSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FunctionPointerSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new FunctionPointerSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new GenericParameterHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MemberReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MemberReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodInstantiationHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodInstantiationHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodSemanticsHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodTypeVariableSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new MethodTypeVariableSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ModifiedTypeHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ModifiedTypeHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamedArgumentHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamespaceDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new NamespaceReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ParameterHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PointerSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PointerSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PropertyHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PropertySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out QualifiedFieldHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new QualifiedFieldHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out QualifiedMethodHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new QualifiedMethodHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out SZArraySignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new SZArraySignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ScopeDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new ScopeReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeDefinitionHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeDefinitionHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeForwarderHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeInstantiationSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeInstantiationSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeReferenceHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeReferenceHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeSpecificationHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeSpecificationHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeVariableSignatureHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new TypeVariableSignatureHandle((int)value); handle._Validate(); return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamedArgumentHandleCollection values) { values = new NamedArgumentHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodSemanticsHandleCollection values) { values = new MethodSemanticsHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out CustomAttributeHandleCollection values) { values = new CustomAttributeHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ParameterHandleCollection values) { values = new ParameterHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out GenericParameterHandleCollection values) { values = new GenericParameterHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeDefinitionHandleCollection values) { values = new TypeDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out TypeForwarderHandleCollection values) { values = new TypeForwarderHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out NamespaceDefinitionHandleCollection values) { values = new NamespaceDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out MethodHandleCollection values) { values = new MethodHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out FieldHandleCollection values) { values = new FieldHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandleCollection values) { values = new PropertyHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out EventHandleCollection values) { values = new EventHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read public static uint Read(this NativeReader reader, uint offset, out ScopeDefinitionHandleCollection values) { values = new ScopeDefinitionHandleCollection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); for (uint i = 0; i < count; ++i) { offset = reader.SkipInteger(offset); } return offset; } // Read } // MdBinaryReader } // Internal.Metadata.NativeFormat
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./eng/python.targets
<Project> <Target Name="FindPythonWindows" Condition="$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''" Returns="$(PYTHON)"> <PropertyGroup> <_PythonLocationScript>-c "import sys; sys.stdout.write(sys.executable)"</_PythonLocationScript> </PropertyGroup> <Exec Command="py -3 $(_PythonLocationScript) 2&gt; nul || python3 $(_PythonLocationScript) 2&gt; nul || python $(_PythonLocationScript) 2&gt; nul" StandardOutputImportance="Low" EchoOff="true" ConsoleToMsBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" /> </Exec> <PropertyGroup> <PYTHON>"$(PYTHON)"</PYTHON> </PropertyGroup> </Target> <Target Name="FindPythonUnix" Condition="!$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''" Returns="$(PYTHON)"> <Exec Command="command -v python3 || command -v python || command -v py" StandardOutputImportance="Low" EchoOff="true" ConsoleToMsBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" /> </Exec> <PropertyGroup> <PYTHON>"$(PYTHON)"</PYTHON> </PropertyGroup> </Target> <Target Name="FindPython" DependsOnTargets="FindPythonWindows;FindPythonUnix" /> </Project>
<Project> <Target Name="FindPythonWindows" Condition="$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''" Returns="$(PYTHON)"> <PropertyGroup> <_PythonLocationScript>-c "import sys; sys.stdout.write(sys.executable)"</_PythonLocationScript> </PropertyGroup> <Exec Command="py -3 $(_PythonLocationScript) 2&gt; nul || python3 $(_PythonLocationScript) 2&gt; nul || python $(_PythonLocationScript) 2&gt; nul" StandardOutputImportance="Low" EchoOff="true" ConsoleToMsBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" /> </Exec> <PropertyGroup> <PYTHON>"$(PYTHON)"</PYTHON> </PropertyGroup> </Target> <Target Name="FindPythonUnix" Condition="!$([MSBuild]::IsOSPlatform(Windows)) and '$(PYTHON)' == ''" Returns="$(PYTHON)"> <Exec Command="command -v python3 || command -v python || command -v py" StandardOutputImportance="Low" EchoOff="true" ConsoleToMsBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="PYTHON" /> </Exec> <PropertyGroup> <PYTHON>"$(PYTHON)"</PYTHON> </PropertyGroup> </Target> <Target Name="FindPython" DependsOnTargets="FindPythonWindows;FindPythonUnix" /> </Project>
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/SIMD/VectorExp.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; using System.Numerics; internal partial class VectorTest { private const int Pass = 100; private const int Fail = -1; private class VectorExpTest<T> where T : struct, IComparable<T>, IEquatable<T> { public static int VectorExp(Vector<T> x, T checkValue, T epsilon, T allowableError) { Vector<T> sum = Vector<T>.One; Vector<T> count = Vector<T>.One; Vector<T> term = x; Vector<T> epsilonVec = new Vector<T>(epsilon); do { if (Vector.LessThanOrEqualAll<T>(Vector.Abs(term), epsilonVec)) break; sum = sum + term; count = count + Vector<T>.One; term = term * (x / count); } while (true); if (Vector.LessThanOrEqualAll<T>((Vector.Abs(sum) - new Vector<T>(checkValue)), new Vector<T>(allowableError))) { return Pass; } else { Console.WriteLine("Failed " + typeof(T).Name); VectorPrint(" sum: ", sum); return Fail; } } } private static int Main() { int returnVal = Pass; if (VectorExpTest<float>.VectorExp(Vector<float>.One, (float)Math.Exp(1d), Single.Epsilon, 1E-06f) != Pass) { returnVal = Fail; } if (VectorExpTest<double>.VectorExp(Vector<double>.One, Math.Exp(1d), Double.Epsilon, 1E-14) != Pass) { returnVal = Fail; } if (VectorExpTest<int>.VectorExp(Vector<int>.One, (int)Math.Exp(1), 0, 0) != Pass) { returnVal = Fail; } if (VectorExpTest<long>.VectorExp(Vector<long>.One, (long)Math.Exp(1), 0, 0) != Pass) { returnVal = Fail; } return returnVal; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; using System.Numerics; internal partial class VectorTest { private const int Pass = 100; private const int Fail = -1; private class VectorExpTest<T> where T : struct, IComparable<T>, IEquatable<T> { public static int VectorExp(Vector<T> x, T checkValue, T epsilon, T allowableError) { Vector<T> sum = Vector<T>.One; Vector<T> count = Vector<T>.One; Vector<T> term = x; Vector<T> epsilonVec = new Vector<T>(epsilon); do { if (Vector.LessThanOrEqualAll<T>(Vector.Abs(term), epsilonVec)) break; sum = sum + term; count = count + Vector<T>.One; term = term * (x / count); } while (true); if (Vector.LessThanOrEqualAll<T>((Vector.Abs(sum) - new Vector<T>(checkValue)), new Vector<T>(allowableError))) { return Pass; } else { Console.WriteLine("Failed " + typeof(T).Name); VectorPrint(" sum: ", sum); return Fail; } } } private static int Main() { int returnVal = Pass; if (VectorExpTest<float>.VectorExp(Vector<float>.One, (float)Math.Exp(1d), Single.Epsilon, 1E-06f) != Pass) { returnVal = Fail; } if (VectorExpTest<double>.VectorExp(Vector<double>.One, Math.Exp(1d), Double.Epsilon, 1E-14) != Pass) { returnVal = Fail; } if (VectorExpTest<int>.VectorExp(Vector<int>.One, (int)Math.Exp(1), 0, 0) != Pass) { returnVal = Fail; } if (VectorExpTest<long>.VectorExp(Vector<long>.One, (long)Math.Exp(1), 0, 0) != Pass) { returnVal = Fail; } return returnVal; } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/mono/mono/tests/bug-8417.cs
#define USE_REDIRECT using System; using System.IO; using System.Text; using System.Collections.Generic; using System.Diagnostics; namespace Example { public static class EntryPoint { public static bool RunProcess (string filename, string arguments, out int exitCode, out string stdout, bool capture_stderr = false) { var sb = new StringBuilder (); var stdout_done = new System.Threading.ManualResetEvent (false); var stderr_done = new System.Threading.ManualResetEvent (false); using (var p = new Process ()) { p.StartInfo.FileName = filename; p.StartInfo.Arguments = arguments; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = capture_stderr; p.OutputDataReceived += (sender, e) => { if (e.Data == null) { stdout_done.Set (); } else { lock (sb) sb.AppendLine (e.Data); } }; if (capture_stderr) { p.ErrorDataReceived += (sender, e) => { if (e.Data == null) { stderr_done.Set (); } else { lock (sb) sb.AppendLine (e.Data); } }; } p.Start (); p.BeginOutputReadLine (); if (capture_stderr) p.BeginErrorReadLine (); p.WaitForExit (); stdout_done.WaitOne (TimeSpan.FromSeconds (1)); if (capture_stderr) stderr_done.WaitOne (TimeSpan.FromSeconds (1)); stdout = sb.ToString (); exitCode = p.ExitCode; return exitCode == 0; } } static string RunRedirectOutput (Action action) { var existingOut = Console.Out; var existingErr = Console.Error; try { using (StringWriter writer = new StringWriter ()) { #if USE_REDIRECT Console.SetOut (writer); Console.SetError (writer); #endif action (); return writer.ToString (); } } finally { Console.SetOut (existingOut); Console.SetError (existingErr); } } static void RunProcess () { RunProcess ("/bin/echo", "who am i", out int exitCode, out string stdout); Console.Write (stdout); } public static int Main () { var str = RunRedirectOutput (RunProcess); Console.WriteLine ("'{0}'", str); return str == "who am i\n" ? 0 : 1; } } }
#define USE_REDIRECT using System; using System.IO; using System.Text; using System.Collections.Generic; using System.Diagnostics; namespace Example { public static class EntryPoint { public static bool RunProcess (string filename, string arguments, out int exitCode, out string stdout, bool capture_stderr = false) { var sb = new StringBuilder (); var stdout_done = new System.Threading.ManualResetEvent (false); var stderr_done = new System.Threading.ManualResetEvent (false); using (var p = new Process ()) { p.StartInfo.FileName = filename; p.StartInfo.Arguments = arguments; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = capture_stderr; p.OutputDataReceived += (sender, e) => { if (e.Data == null) { stdout_done.Set (); } else { lock (sb) sb.AppendLine (e.Data); } }; if (capture_stderr) { p.ErrorDataReceived += (sender, e) => { if (e.Data == null) { stderr_done.Set (); } else { lock (sb) sb.AppendLine (e.Data); } }; } p.Start (); p.BeginOutputReadLine (); if (capture_stderr) p.BeginErrorReadLine (); p.WaitForExit (); stdout_done.WaitOne (TimeSpan.FromSeconds (1)); if (capture_stderr) stderr_done.WaitOne (TimeSpan.FromSeconds (1)); stdout = sb.ToString (); exitCode = p.ExitCode; return exitCode == 0; } } static string RunRedirectOutput (Action action) { var existingOut = Console.Out; var existingErr = Console.Error; try { using (StringWriter writer = new StringWriter ()) { #if USE_REDIRECT Console.SetOut (writer); Console.SetError (writer); #endif action (); return writer.ToString (); } } finally { Console.SetOut (existingOut); Console.SetError (existingErr); } } static void RunProcess () { RunProcess ("/bin/echo", "who am i", out int exitCode, out string stdout); Console.Write (stdout); } public static int Main () { var str = RunRedirectOutput (RunProcess); Console.WriteLine ("'{0}'", str); return str == "who am i\n" ? 0 : 1; } } }
-1
dotnet/runtime
65,966
Use SubtleCrypto API on browser DOM scenarios
Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
layomia
2022-02-28T18:25:51Z
2022-05-24T22:19:32Z
c5f949efa20bcb555c453037fa954fcc403f9490
bfbb78354e536ac616f2f9dabf3db2b8fa8b9f64
Use SubtleCrypto API on browser DOM scenarios. Contributes to https://github.com/dotnet/runtime/issues/40074. For WASM, uses the [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) browser-native implementation for the SHA1, SHA256, SHA384, SHA512 algorithms, and adds infrastructure to support using the native implementation. Support for the rest of the algorithms will come in a single follow-up PR.
./src/tests/JIT/Methodical/int64/superlong/superlong.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { } .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } .assembly 'superlong'// as "superlong" { } .assembly extern xunit.core {} // MVID: {571950B7-63D3-4968-948F-25114244E0B8} .namespace JitTest_superlong_il { .class value public auto ansi sealed superlong extends ['mscorlib']System.ValueType { .field private unsigned int64 lo .field private unsigned int64 hi .method private hidebysig instance void Assign(value class JitTest_superlong_il.superlong v) il managed { // Code size 27 (0x1b) .maxstack 9 ldarg.0 dup ldarga.s v ldfld unsigned int64 JitTest_superlong_il.superlong::hi stfld unsigned int64 JitTest_superlong_il.superlong::hi ldarga.s v ldfld unsigned int64 JitTest_superlong_il.superlong::lo stfld unsigned int64 JitTest_superlong_il.superlong::lo ret } // end of method 'superlong::Assign' .method private hidebysig static value class JitTest_superlong_il.superlong 'add'(value class JitTest_superlong_il.superlong op1, value class JitTest_superlong_il.superlong op2) il managed { // Code size 101 (0x65) .maxstack 3 .locals (value class JitTest_superlong_il.superlong V_0, value class JitTest_superlong_il.superlong V_1) IL_0000: ldloca.s V_0 IL_0002: initobj JitTest_superlong_il.superlong IL_0008: ldloca.s V_0 IL_000a: ldarga.s op1 IL_000c: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0011: ldarga.s op2 IL_0013: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0018: add.ovf.un IL_0019: stfld unsigned int64 JitTest_superlong_il.superlong::hi .try { IL_001e: ldloca.s V_0 IL_0020: ldarga.s op1 IL_0022: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0027: ldarga.s op2 IL_0029: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_002e: add.ovf.un IL_002f: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0034: leave.s IL_005f } // end .try catch ['mscorlib']System.OverflowException { IL_0036: pop IL_0037: ldloca.s V_0 IL_0039: ldarga.s op1 IL_003b: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0040: ldarga.s op2 IL_0042: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0047: add IL_0048: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_004d: ldloca.s V_0 IL_004f: dup IL_0050: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0055: ldc.i4.1 IL_0056: conv.i8 IL_0057: add.ovf.un IL_0058: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_005d: leave.s IL_005f } // end handler IL_005f: ldloc.0 IL_0060: stloc.1 IL_0063: ldloc.1 IL_0064: ret } // end of method 'superlong::add' .method public hidebysig static int32 Main() il managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint // Code size 305 (0x131) .maxstack 2 .locals (value class JitTest_superlong_il.superlong V_0, value class JitTest_superlong_il.superlong V_1, value class JitTest_superlong_il.superlong V_2, int32 V_3) IL_0000: ldloca.s V_0 IL_0002: initobj JitTest_superlong_il.superlong IL_0008: ldloca.s V_1 IL_000a: initobj JitTest_superlong_il.superlong IL_0010: ldloca.s V_0 IL_0012: ldc.i8 0x8000000000000000 IL_001b: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0020: ldloca.s V_0 IL_0022: ldc.i4.0 IL_0023: conv.i8 IL_0024: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0029: ldloca.s V_1 IL_002b: ldc.i8 0x7fffffffffffffff IL_0034: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0039: ldloca.s V_1 IL_003b: ldc.i4.m1 IL_003c: conv.i8 IL_003d: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0042: ldloc.0 IL_0043: ldloc.1 IL_0044: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_0049: stloc.2 IL_004a: ldloca.s V_2 IL_004c: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0051: ldc.i4.m1 IL_0052: conv.i8 IL_0053: bne.un.s IL_0060 IL_0055: ldloca.s V_2 IL_0057: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_005c: ldc.i4.m1 IL_005d: conv.i8 IL_005e: beq.s IL_0071 IL_0060: ldstr "Failed." IL_0065: call void [System.Console]System.Console::WriteLine(class System.String) IL_006a: ldc.i4.1 IL_006b: stloc.3 IL_006c: br IL_012f IL_0071: ldloca.s V_0 IL_0073: ldc.i8 0x8000000000000000 IL_007c: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0081: ldloca.s V_0 IL_0083: ldc.i4.0 IL_0084: conv.i8 IL_0085: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_008a: ldloca.s V_1 IL_008c: ldloc.0 IL_008d: call instance void JitTest_superlong_il.superlong::Assign(value class JitTest_superlong_il.superlong) .try { IL_0092: ldloc.0 IL_0093: ldloc.1 IL_0094: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_0099: stloc.2 IL_009a: leave IL_0121 } // end .try catch ['mscorlib']System.OverflowException { IL_009f: pop IL_00a0: ldloca.s V_0 IL_00a2: ldc.i8 0x1234567876543210 IL_00ab: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00b0: ldloca.s V_0 IL_00b2: ldc.i8 0xfdcba98789abcdef IL_00bb: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00c0: ldloca.s V_1 IL_00c2: ldc.i8 0xedcba98789abcdee IL_00cb: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00d0: ldloca.s V_1 IL_00d2: ldc.i8 0x1234567876543210 IL_00db: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00e0: ldloc.0 IL_00e1: ldloc.1 IL_00e2: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_00e7: stloc.2 IL_00e8: ldloca.s V_2 IL_00ea: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00ef: ldc.i4.m1 IL_00f0: conv.i8 IL_00f1: bne.un.s IL_0105 IL_00f3: ldloca.s V_2 IL_00f5: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00fa: ldc.i8 0xfffffffffffffff IL_0103: beq.s IL_0113 IL_0105: ldstr "Failed (3)." IL_010a: call void [System.Console]System.Console::WriteLine(class System.String) IL_010f: ldc.i4.1 IL_0110: stloc.3 IL_0111: leave.s IL_012f IL_0113: ldstr "Passed!" IL_0118: call void [System.Console]System.Console::WriteLine(class System.String) IL_011d: ldc.i4 0x64 IL_011e: stloc.3 IL_011f: leave.s IL_012f } // end handler IL_0121: ldstr "Failed (2)." IL_0126: call void [System.Console]System.Console::WriteLine(class System.String) IL_012b: ldc.i4.1 IL_012c: stloc.3 IL_012d: br.s IL_012f IL_012f: ldloc.3 IL_0130: ret } // end of method 'superlong::Main' } // end of class 'superlong' } // end of namespace 'JitTest_superlong_il' //*********** DISASSEMBLY COMPLETE ***********************
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { } .assembly extern System.Console { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 4:0:0:0 } .assembly 'superlong'// as "superlong" { } .assembly extern xunit.core {} // MVID: {571950B7-63D3-4968-948F-25114244E0B8} .namespace JitTest_superlong_il { .class value public auto ansi sealed superlong extends ['mscorlib']System.ValueType { .field private unsigned int64 lo .field private unsigned int64 hi .method private hidebysig instance void Assign(value class JitTest_superlong_il.superlong v) il managed { // Code size 27 (0x1b) .maxstack 9 ldarg.0 dup ldarga.s v ldfld unsigned int64 JitTest_superlong_il.superlong::hi stfld unsigned int64 JitTest_superlong_il.superlong::hi ldarga.s v ldfld unsigned int64 JitTest_superlong_il.superlong::lo stfld unsigned int64 JitTest_superlong_il.superlong::lo ret } // end of method 'superlong::Assign' .method private hidebysig static value class JitTest_superlong_il.superlong 'add'(value class JitTest_superlong_il.superlong op1, value class JitTest_superlong_il.superlong op2) il managed { // Code size 101 (0x65) .maxstack 3 .locals (value class JitTest_superlong_il.superlong V_0, value class JitTest_superlong_il.superlong V_1) IL_0000: ldloca.s V_0 IL_0002: initobj JitTest_superlong_il.superlong IL_0008: ldloca.s V_0 IL_000a: ldarga.s op1 IL_000c: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0011: ldarga.s op2 IL_0013: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0018: add.ovf.un IL_0019: stfld unsigned int64 JitTest_superlong_il.superlong::hi .try { IL_001e: ldloca.s V_0 IL_0020: ldarga.s op1 IL_0022: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0027: ldarga.s op2 IL_0029: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_002e: add.ovf.un IL_002f: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0034: leave.s IL_005f } // end .try catch ['mscorlib']System.OverflowException { IL_0036: pop IL_0037: ldloca.s V_0 IL_0039: ldarga.s op1 IL_003b: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0040: ldarga.s op2 IL_0042: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0047: add IL_0048: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_004d: ldloca.s V_0 IL_004f: dup IL_0050: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0055: ldc.i4.1 IL_0056: conv.i8 IL_0057: add.ovf.un IL_0058: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_005d: leave.s IL_005f } // end handler IL_005f: ldloc.0 IL_0060: stloc.1 IL_0063: ldloc.1 IL_0064: ret } // end of method 'superlong::add' .method public hidebysig static int32 Main() il managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint // Code size 305 (0x131) .maxstack 2 .locals (value class JitTest_superlong_il.superlong V_0, value class JitTest_superlong_il.superlong V_1, value class JitTest_superlong_il.superlong V_2, int32 V_3) IL_0000: ldloca.s V_0 IL_0002: initobj JitTest_superlong_il.superlong IL_0008: ldloca.s V_1 IL_000a: initobj JitTest_superlong_il.superlong IL_0010: ldloca.s V_0 IL_0012: ldc.i8 0x8000000000000000 IL_001b: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0020: ldloca.s V_0 IL_0022: ldc.i4.0 IL_0023: conv.i8 IL_0024: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0029: ldloca.s V_1 IL_002b: ldc.i8 0x7fffffffffffffff IL_0034: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0039: ldloca.s V_1 IL_003b: ldc.i4.m1 IL_003c: conv.i8 IL_003d: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_0042: ldloc.0 IL_0043: ldloc.1 IL_0044: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_0049: stloc.2 IL_004a: ldloca.s V_2 IL_004c: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0051: ldc.i4.m1 IL_0052: conv.i8 IL_0053: bne.un.s IL_0060 IL_0055: ldloca.s V_2 IL_0057: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_005c: ldc.i4.m1 IL_005d: conv.i8 IL_005e: beq.s IL_0071 IL_0060: ldstr "Failed." IL_0065: call void [System.Console]System.Console::WriteLine(class System.String) IL_006a: ldc.i4.1 IL_006b: stloc.3 IL_006c: br IL_012f IL_0071: ldloca.s V_0 IL_0073: ldc.i8 0x8000000000000000 IL_007c: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_0081: ldloca.s V_0 IL_0083: ldc.i4.0 IL_0084: conv.i8 IL_0085: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_008a: ldloca.s V_1 IL_008c: ldloc.0 IL_008d: call instance void JitTest_superlong_il.superlong::Assign(value class JitTest_superlong_il.superlong) .try { IL_0092: ldloc.0 IL_0093: ldloc.1 IL_0094: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_0099: stloc.2 IL_009a: leave IL_0121 } // end .try catch ['mscorlib']System.OverflowException { IL_009f: pop IL_00a0: ldloca.s V_0 IL_00a2: ldc.i8 0x1234567876543210 IL_00ab: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00b0: ldloca.s V_0 IL_00b2: ldc.i8 0xfdcba98789abcdef IL_00bb: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00c0: ldloca.s V_1 IL_00c2: ldc.i8 0xedcba98789abcdee IL_00cb: stfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00d0: ldloca.s V_1 IL_00d2: ldc.i8 0x1234567876543210 IL_00db: stfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00e0: ldloc.0 IL_00e1: ldloc.1 IL_00e2: call value class JitTest_superlong_il.superlong JitTest_superlong_il.superlong::'add'(value class JitTest_superlong_il.superlong, value class JitTest_superlong_il.superlong) IL_00e7: stloc.2 IL_00e8: ldloca.s V_2 IL_00ea: ldfld unsigned int64 JitTest_superlong_il.superlong::hi IL_00ef: ldc.i4.m1 IL_00f0: conv.i8 IL_00f1: bne.un.s IL_0105 IL_00f3: ldloca.s V_2 IL_00f5: ldfld unsigned int64 JitTest_superlong_il.superlong::lo IL_00fa: ldc.i8 0xfffffffffffffff IL_0103: beq.s IL_0113 IL_0105: ldstr "Failed (3)." IL_010a: call void [System.Console]System.Console::WriteLine(class System.String) IL_010f: ldc.i4.1 IL_0110: stloc.3 IL_0111: leave.s IL_012f IL_0113: ldstr "Passed!" IL_0118: call void [System.Console]System.Console::WriteLine(class System.String) IL_011d: ldc.i4 0x64 IL_011e: stloc.3 IL_011f: leave.s IL_012f } // end handler IL_0121: ldstr "Failed (2)." IL_0126: call void [System.Console]System.Console::WriteLine(class System.String) IL_012b: ldc.i4.1 IL_012c: stloc.3 IL_012d: br.s IL_012f IL_012f: ldloc.3 IL_0130: ret } // end of method 'superlong::Main' } // end of class 'superlong' } // end of namespace 'JitTest_superlong_il' //*********** DISASSEMBLY COMPLETE ***********************
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./eng/Subsets.props
<Project> <!-- This file defines the list of projects to build and divides them into subsets. In ordinary situations, you should perform a full build by running 'build.cmd' or './build.sh'. This ensures the projects are sequenced correctly so the outputs and test results are what you would expect. Examples: ./build.sh host.native This builds only the .NET host. ./build.sh libs+host.native This builds the .NET host and also the manged libraries portion. A space ' ' or '+' are the delimiters between multiple subsets to build. ./build.sh -test host.tests This builds and executes the installer test projects. (The '-test' argument is an Arcade SDK argument that indicates tests should be run. Otherwise, they'll only be built.) --> <!-- Determine the primary runtime flavor. This is usually CoreCLR, except on platforms (like s390x) where only Mono is supported. The primary runtime flavor is used to decide when to build the hosts and installers. --> <PropertyGroup> <PrimaryRuntimeFlavor>CoreCLR</PrimaryRuntimeFlavor> <PrimaryRuntimeFlavor Condition="'$(TargetArchitecture)' == 's390x' or '$(TargetArchitecture)' == 'armv6'">Mono</PrimaryRuntimeFlavor> </PropertyGroup> <PropertyGroup> <DefaultSubsets>clr+mono+libs+host+packs</DefaultSubsets> <DefaultSubsets Condition="'$(TargetsMobile)' == 'true'">mono+libs+packs</DefaultSubsets> <!-- In source build, mono is only supported as primary runtime flavor. On Windows mono is supported for x86/x64 only. --> <DefaultSubsets Condition="('$(DotNetBuildFromSource)' == 'true' and '$(PrimaryRuntimeFlavor)' != 'Mono') or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' != 'x86' and '$(TargetArchitecture)' != 'x64')">clr+libs+host+packs</DefaultSubsets> </PropertyGroup> <!-- Init _subset here to allow RuntimeFlavor to be set as early as possible --> <PropertyGroup> <_subset Condition="'$(Subset)' != ''">+$(Subset.ToLowerInvariant())+</_subset> <_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+</_subset> </PropertyGroup> <PropertyGroup> <RuntimeFlavor Condition="'$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor> <RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')))">Mono</RuntimeFlavor> <RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">$(PrimaryRuntimeFlavor)</RuntimeFlavor> </PropertyGroup> <PropertyGroup> <!-- CLR NativeAot only builds in a subset of the matrix --> <NativeAotSupported Condition="('$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64') and ('$(TargetOS)' != 'OSX' or '$(TargetArchitecture)' != 'arm64')">true</NativeAotSupported> <!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib --> <UseNativeAotCoreLib Condition="$(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+'))">true</UseNativeAotCoreLib> </PropertyGroup> <PropertyGroup> <DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets> <!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. --> <DefaultCoreClrSubsets Condition="'$(PrimaryRuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets> <DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(MonoAOTLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(TargetOS)' == 'Browser'">$(DefaultMonoSubsets)mono.wasmruntime+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(MonoCrossAOTTargetOS)' != ''">$(DefaultMonoSubsets)mono.aotcross+</DefaultMonoSubsets> <DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages</DefaultMonoSubsets> <DefaultLibrariesSubsets Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == '' or '$(BuildAllConfigurations)' == 'true'">libs.native+</DefaultLibrariesSubsets> <DefaultLibrariesSubsets>$(DefaultLibrariesSubsets)libs.sfx+libs.oob</DefaultLibrariesSubsets> <DefaultLibrariesSubsets Condition="'$(DotNetBuildFromSource)' != 'true'">$(DefaultLibrariesSubsets)+libs.pretest</DefaultLibrariesSubsets> <DefaultHostSubsets>host.native+host.tools</DefaultHostSubsets> <DefaultHostSubsets Condition="'$(DotNetBuildFromSource)' != 'true'">$(DefaultHostSubsets)+host.pkg+host.tests</DefaultHostSubsets> <DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'"></DefaultHostSubsets> <DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'">host.native</DefaultHostSubsets> <DefaultPacksSubsets>packs.product</DefaultPacksSubsets> <DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and '$(DotNetBuildFromSource)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets> <DefaultPacksSubsets Condition="'$(DotNetBuildFromSource)' == 'true'">$(DefaultPacksSubsets)+packs.installers</DefaultPacksSubsets> </PropertyGroup> <PropertyGroup> <_subset>$(_subset.Replace('+clr.paltests+', '+clr.paltests+clr.paltestlist+'))</_subset> <_subset>$(_subset.Replace('+clr+', '+$(DefaultCoreClrSubsets)+'))</_subset> <_subset>$(_subset.Replace('+mono+', '+$(DefaultMonoSubsets)+'))</_subset> <_subset>$(_subset.Replace('+libs+', '+$(DefaultLibrariesSubsets)+'))</_subset> <_subset>$(_subset.Replace('+host+', '+$(DefaultHostSubsets)+'))</_subset> <_subset>$(_subset.Replace('+packs+', '+$(DefaultPacksSubsets)+'))</_subset> <!-- Surround _subset in dashes to simplify checks below --> <_subset>+$(_subset.Trim('+'))+</_subset> <ClrRuntimeBuildSubsets></ClrRuntimeBuildSubsets> <ClrDefaultRuntimeBuildSubsets>ClrRuntimeSubset=true;ClrJitSubset=true;ClrILToolsSubset=true</ClrDefaultRuntimeBuildSubsets> </PropertyGroup> <ItemGroup> <!-- CoreClr --> <SubsetName Include="Clr" Description="The full CoreCLR runtime. Equivalent to: $(DefaultCoreClrSubsets)" /> <SubsetName Include="Clr.NativePrereqs" Description="Managed tools that support building the native components of the runtime (such as DacTableGen)." /> <SubsetName Include="Clr.ILTools" Description="The CoreCLR IL tools (ilasm/ildasm)." /> <SubsetName Include="Clr.Runtime" Description="The CoreCLR .NET runtime. Includes clr.jit, clr.iltools, clr.hosts." /> <SubsetName Include="Clr.Native" Description="All CoreCLR native non-test components, including the runtime, jits, and other native tools. Includes clr.hosts, clr.runtime, clr.jit, clr.alljits, clr.paltests, clr.iltools, clr.nativeaotruntime, clr.spmi." /> <SubsetName Include="Clr.NativeAotLibs" Description="The CoreCLR native AOT CoreLib and other low level class libraries." /> <SubsetName Include="Clr.NativeAotRuntime" Description="The stripped-down CoreCLR native AOT runtime." /> <SubsetName Include="Clr.CrossArchTools" Description="The cross-targetted CoreCLR tools." /> <SubsetName Include="Clr.PalTests" OnDemand="true" Description="The CoreCLR PAL tests." /> <SubsetName Include="Clr.PalTestList" OnDemand="true" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." /> <SubsetName Include="Clr.Hosts" Description="The CoreCLR corerun test host." /> <SubsetName Include="Clr.Jit" Description="The JIT for the CoreCLR .NET runtime." /> <SubsetName Include="Clr.AllJits" Description="All of the cross-targeting JIT compilers for the CoreCLR .NET runtime." /> <SubsetName Include="Clr.Spmi" Description="SuperPMI, a tool for CoreCLR JIT testing." /> <SubsetName Include="Clr.CoreLib" Description="The managed System.Private.CoreLib library for CoreCLR." /> <SubsetName Include="Clr.NativeCoreLib" Description="Run crossgen on System.Private.CoreLib library for CoreCLR." /> <SubsetName Include="Clr.Tools" Description="Managed tools that support CoreCLR development and testing." /> <SubsetName Include="Clr.ToolsTests" OnDemand="true" Description="Unit tests for the clr.tools subset." /> <SubsetName Include="Clr.Packages" Description="The projects that produce NuGet packages for the CoreCLR runtime, crossgen, and IL tools." /> <SubsetName Include="LinuxDac" Condition="$([MSBuild]::IsOsPlatform(Windows))" Description="The cross-OS Windows->libc-based Linux DAC. Skipped on x86." /> <SubsetName Include="AlpineDac" Condition="$([MSBuild]::IsOsPlatform(Windows))" OnDemand="true" Description="The cross-OS Windows->musl-libc-based Linux DAC. Skipped on x86" /> <SubsetName Include="CrossDacPack" OnDemand="true" Description="Packaging of cross OS DAC. Requires all assets needed to be present at a folder specified by $(CrossDacArtifactsDir). See 'Microsoft.CrossOsDiag.Private.CoreCLR.proj' for details." /> <!-- Mono --> <SubsetName Include="Mono" Description="The Mono runtime and CoreLib. Equivalent to: $(DefaultMonoSubsets)" /> <SubsetName Include="Mono.Runtime" Description="The Mono .NET runtime." /> <SubsetName Include="Mono.AotCross" Description="The cross-compiler runtime for Mono AOT." /> <SubsetName Include="Mono.CoreLib" Description="The managed System.Private.CoreLib library for Mono." /> <SubsetName Include="Mono.Packages" Description="The projects that produce NuGet packages for the Mono runtime." /> <SubsetName Include="Mono.WasmRuntime" Description="The WebAssembly runtime." /> <SubsetName Include="Mono.MsCorDbi" Description="The implementation of ICorDebug interface." /> <SubsetName Include="Mono.Workloads" OnDemand="true" Description="Builds the installers and the insertion metadata for Blazor workloads." /> <!-- Host --> <SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests. Equivalent to: $(DefaultHostSubsets)" /> <SubsetName Include="Host.Native" Description="The .NET hosts." /> <SubsetName Include="Host.Pkg" Description="The .NET host packages." /> <SubsetName Include="Host.Tools" Description="The .NET hosting libraries." /> <SubsetName Include="Host.Tests" Description="The .NET hosting tests." /> <!-- Libs --> <SubsetName Include="Libs" Description="The libraries native part, refs and source assemblies, test infra and packages, but NOT the tests (use Libs.Tests to request those explicitly). Equivalent to: $(DefaultLibrariesSubsets)" /> <SubsetName Include="Libs.Native" Description="The native libraries used in the shared framework." /> <SubsetName Include="Libs.Sfx" Description="The managed shared framework libraries." /> <SubsetName Include="Libs.Oob" Description="The managed out-of-band libraries." /> <SubsetName Include="Libs.Ref" OnDemand="true" Description="The managed reference libraries." /> <SubsetName Include="Libs.Src" OnDemand="true" Description="The managed implementation libraries." /> <SubsetName Include="Libs.PreTest" Description="Test assets which are necessary to run tests." /> <SubsetName Include="Libs.Packages" Description="The projects that produce NuGet packages from libraries." /> <SubsetName Include="Libs.Tests" OnDemand="true" Description="The test projects. Note that building this doesn't execute tests: you must also pass the '-test' argument." /> <!-- Packs --> <SubsetName Include="Packs" Description="Builds the shared framework packs, archives, bundles, installers, and the framework pack tests. Equivalent to: $(DefaultPacksSubsets)" /> <SubsetName Include="Packs.Product" Description="Builds the shared framework packs, archives, bundles, and installers." /> <SubsetName Include="Packs.Installers" Description="Builds the shared framework bundles and installers." /> <SubsetName Include="Packs.Tests" Description="The framework pack tests." /> <!-- Utility --> <SubsetName Include="publish" OnDemand="true" Description="Generate asset manifests and prepare to publish to BAR." /> <SubsetName Include="RegenerateDownloadTable" OnDemand="true" Description="Regenerates the nightly build download table" /> <SubsetName Include="RegenerateThirdPartyNotices" OnDemand="true" Description="Regenerates the THIRD-PARTY-NOTICES.TXT file based on other repos' TPN files." /> </ItemGroup> <!-- Default targets, parallelization and configurations. --> <ItemDefinitionGroup> <ProjectToBuild> <Test>false</Test> <Pack>false</Pack> <Publish>false</Publish> <BuildInParallel>false</BuildInParallel> </ProjectToBuild> </ItemDefinitionGroup> <!-- CoreClr sets --> <ItemGroup Condition="$(_subset.Contains('+clr.corelib+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="clr" /> </ItemGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.hosts+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrHostsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.runtime+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.native+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrFullNativeBuild=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.jit+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrJitSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.paltests+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrPalTestsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.alljits+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.iltools+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrILToolsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.nativeaotruntime+')) and '$(NativeAotSupported)' == 'true'"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrNativeAotSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.spmi+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrSpmiSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != '' or $(_subset.Contains('+clr.nativeprereqs+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime-prereqs.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != ''"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties);$(ClrRuntimeBuildSubsets)" Category="clr" /> </ItemGroup> <!-- Build the CoreCLR cross-arch tools when we're doing a cross-architecture build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them --> <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and '$(BuildArchitecture)' != '$(TargetArchitecture)'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(BuildArchitecture); PgoInstrument=false; NoPgoOptimize=true; CrossBuild=false; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' == 'x64'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=x86; PgoInstrument=false; NoPgoOptimize=true; CrossBuild=false; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.paltestlist+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)pal/tests/palsuite/producepaltestlist.proj" /> </ItemGroup> <PropertyGroup> <CrossDacHostArch>x64</CrossDacHostArch> <CrossDacHostArch Condition="'$(TargetArchitecture)' == 'arm'">x86</CrossDacHostArch> </PropertyGroup> <ItemGroup Condition="$(_subset.Contains('+linuxdac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(CrossDacHostArch); PgoInstrument=false; NoPgoOptimize=true; TargetOS=Linux; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+alpinedac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(CrossDacHostArch); PgoInstrument=false; NoPgoOptimize=true; TargetOS=alpine; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+crossdacpack+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot).nuget\Microsoft.CrossOsDiag.Private.CoreCLR\Microsoft.CrossOsDiag.Private.CoreCLR.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.tools+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\runincontext\runincontext.csproj; $(CoreClrProjectRoot)tools\tieringtest\tieringtest.csproj; $(CoreClrProjectRoot)tools\r2rdump\R2RDump.csproj; $(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo.csproj; $(CoreClrProjectRoot)tools\aot\ILCompiler\repro\repro.csproj; $(CoreClrProjectRoot)tools\r2rtest\R2RTest.csproj" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Build.Tasks\ILCompiler.Build.Tasks.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" /> <ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.toolstests+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj" Test="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Compiler.Tests\ILCompiler.Compiler.Tests.csproj" Test="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(NativeAotSupported)' == 'true'"/> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.nativecorelib+'))"> <!-- Build crossgen2 that will be used to compile System.Private.CoreLib library for CoreCLR --> <ProjectToBuild Condition="'$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> <ProjectToBuild Condition="!('$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64')" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.packages+')) and '$(PgoInstrument)' != 'true'"> <ProjectToBuild Include="$(CoreClrProjectRoot).nuget\coreclr-packages.proj" Pack="true" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo-pack.proj" Pack="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(RuntimeFlavor)' != 'Mono'"/> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.nativeaotlibs+')) and '$(NativeAotSupported)' == 'true'"> <ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\**\src\*.csproj" Category="clr" /> </ItemGroup> <!-- Mono sets --> <ItemGroup Condition="$(_subset.Contains('+mono.llvm+')) or $(_subset.Contains('+mono.aotcross+')) or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'Browser'"> <ProjectToBuild Include="$(MonoProjectRoot)llvm\llvm-init.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.packages+'))"> <ProjectToBuild Include="$(MonoProjectRoot)nuget\mono-packages.proj" Category="mono" Pack="true" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.runtime+'))"> <ProjectToBuild Include="$(MonoProjectRoot)mono.proj" AdditionalProperties="%(AdditionalProperties);MonoMsCorDbi=$(_subset.Contains('+mono.mscordbi+'))" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.aotcross+'))"> <ProjectToBuild Include="$(MonoProjectRoot)monoaotcross.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.corelib+'))"> <ProjectToBuild Include="$(MonoProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.workloads+'))"> <ProjectToBuild Include="$(WorkloadsProjectRoot)\workloads.csproj" Category="mono" /> </ItemGroup> <!-- Host sets --> <ItemGroup Condition="$(_subset.Contains('+host.native+'))"> <CorehostProjectToBuild Include="$(SharedNativeRoot)corehost\corehost.proj" SignPhase="Binaries" /> <ProjectToBuild Include="@(CorehostProjectToBuild)" Pack="true" Category="host" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+host.tools+'))"> <ManagedProjectToBuild Include="$(InstallerProjectRoot)managed\**\*.csproj" SignPhase="Binaries" /> <ProjectToBuild Include="@(ManagedProjectToBuild)" BuildInParallel="true" Pack="true" Category="host" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(PgoInstrument)' != 'true'"> <PkgprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\host-packages.proj" SignPhase="MsiFiles" /> <ProjectToBuild Include="@(PkgprojProjectToBuild)" Pack="true" Category="host" /> </ItemGroup> <!-- Libraries sets --> <ItemGroup Condition="$(_subset.Contains('+libs.native+'))"> <ProjectToBuild Include="$(SharedNativeRoot)libs\build-native.proj" Category="libs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.ref+')) or $(_subset.Contains('+libs.src+')) or $(_subset.Contains('+libs.sfx+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)sfx.proj" Category="libs" Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == '' or '$(BuildAllConfigurations)' == 'true'"> <AdditionalProperties Condition="$(_subset.Contains('+libs.ref+'))">%(AdditionalProperties);RefOnly=true</AdditionalProperties> </ProjectToBuild> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.ref+')) or $(_subset.Contains('+libs.src+')) or $(_subset.Contains('+libs.oob+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)oob.proj" Category="libs"> <AdditionalProperties Condition="$(_subset.Contains('+libs.ref+'))">%(AdditionalProperties);RefOnly=true</AdditionalProperties> </ProjectToBuild> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.wasmruntime+'))"> <ProjectToBuild Include="$(MonoProjectRoot)wasm\wasm.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.pretest+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)pretest.proj" Category="libs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.tests+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)tests.proj" Category="libs" Test="true" /> </ItemGroup> <!-- Host.tests subset (consumes live built libraries assets so needs to come after libraries) --> <ItemGroup Condition="$(_subset.Contains('+host.tests+'))"> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\AppHost.Bundle.Tests\AppHost.Bundle.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.AppHost.Tests\Microsoft.NET.HostModel.AppHost.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.Bundle.Tests\Microsoft.NET.HostModel.Bundle.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.ComHost.Tests\Microsoft.NET.HostModel.ComHost.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\HostActivation.Tests\HostActivation.Tests.csproj" /> <ProjectToBuild Include="@(TestProjectToBuild)" BuildInParallel="true" Test="true" Category="host" /> </ItemGroup> <!-- Packs sets --> <Choose> <When Condition="$(_subset.Contains('+packs.product+'))"> <ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'"> <SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.Composite.sfxproj" /> <SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Composite.Bundle.bundleproj" /> </ItemGroup> <ItemGroup Condition="'$(PgoInstrument)' != 'true'"> <SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\archives\dotnet-nethost.proj" /> <SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" /> <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)\pkg\projects\nativeaot-packages.proj" Category="packs" /> </ItemGroup> <ItemGroup> <SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" /> <ProjectToBuild Include="@(SharedFrameworkProjectToBuild)" Category="packs" /> </ItemGroup> </When> </Choose> <ItemGroup Condition="$(_subset.Contains('+packs.installers+')) AND '$(PgoInstrument)' != 'true'"> <InstallerProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\installers.proj" /> <ProjectToBuild Include="@(InstallerProjectToBuild)" Category="packs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+packs.tests+')) AND '$(PgoInstrument)' != 'true'"> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.DotNet.CoreSetup.Packaging.Tests\Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj" /> <ProjectToBuild Include="@(TestProjectToBuild)" BuildInParallel="true" Test="true" Category="packs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+publish+'))"> <ProjectToBuild Include="$(InstallerProjectRoot)prepare-artifacts.proj" Pack="true" Category="publish" /> </ItemGroup> <!-- Utility --> <ItemGroup Condition="$(_subset.Contains('+regeneratedownloadtable+'))"> <ProjectToBuild Include="$(RepositoryEngineeringDir)regenerate-download-table.proj" Pack="true" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('regeneratethirdpartynotices'))"> <ProjectToBuild Include="$(RepositoryEngineeringDir)regenerate-third-party-notices.proj" Pack="false" BuildInParallel="false" /> </ItemGroup> <!-- Set default configurations. --> <ItemGroup> <ProjectToBuild Update="@(ProjectToBuild)"> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'clr' and '$(CoreCLRConfiguration)' != ''">%(AdditionalProperties);Configuration=$(CoreCLRConfiguration)</AdditionalProperties> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'mono' and '$(MonoConfiguration)' != ''">%(AdditionalProperties);Configuration=$(MonoConfiguration)</AdditionalProperties> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'libs' and '$(LibrariesConfiguration)' != ''">%(AdditionalProperties);Configuration=$(LibrariesConfiguration)</AdditionalProperties> </ProjectToBuild> </ItemGroup> </Project>
<Project> <!-- This file defines the list of projects to build and divides them into subsets. In ordinary situations, you should perform a full build by running 'build.cmd' or './build.sh'. This ensures the projects are sequenced correctly so the outputs and test results are what you would expect. Examples: ./build.sh host.native This builds only the .NET host. ./build.sh libs+host.native This builds the .NET host and also the manged libraries portion. A space ' ' or '+' are the delimiters between multiple subsets to build. ./build.sh -test host.tests This builds and executes the installer test projects. (The '-test' argument is an Arcade SDK argument that indicates tests should be run. Otherwise, they'll only be built.) --> <!-- Determine the primary runtime flavor. This is usually CoreCLR, except on platforms (like s390x) where only Mono is supported. The primary runtime flavor is used to decide when to build the hosts and installers. --> <PropertyGroup> <PrimaryRuntimeFlavor>CoreCLR</PrimaryRuntimeFlavor> <PrimaryRuntimeFlavor Condition="'$(TargetArchitecture)' == 's390x' or '$(TargetArchitecture)' == 'armv6'">Mono</PrimaryRuntimeFlavor> </PropertyGroup> <PropertyGroup> <DefaultSubsets>clr+mono+libs+host+packs</DefaultSubsets> <DefaultSubsets Condition="'$(TargetsMobile)' == 'true'">mono+libs+packs</DefaultSubsets> <!-- In source build, mono is only supported as primary runtime flavor. On Windows mono is supported for x86/x64 only. --> <DefaultSubsets Condition="('$(DotNetBuildFromSource)' == 'true' and '$(PrimaryRuntimeFlavor)' != 'Mono') or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' != 'x86' and '$(TargetArchitecture)' != 'x64')">clr+libs+host+packs</DefaultSubsets> </PropertyGroup> <!-- Init _subset here to allow RuntimeFlavor to be set as early as possible --> <PropertyGroup> <_subset Condition="'$(Subset)' != ''">+$(Subset.ToLowerInvariant())+</_subset> <_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+</_subset> </PropertyGroup> <PropertyGroup> <RuntimeFlavor Condition="'$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor> <RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')))">Mono</RuntimeFlavor> <RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">$(PrimaryRuntimeFlavor)</RuntimeFlavor> </PropertyGroup> <PropertyGroup> <!-- CLR NativeAot only builds in a subset of the matrix --> <NativeAotSupported Condition="('$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64') and ('$(TargetOS)' != 'OSX' or '$(TargetArchitecture)' != 'arm64')">true</NativeAotSupported> <!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib --> <UseNativeAotCoreLib Condition="$(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+'))">true</UseNativeAotCoreLib> </PropertyGroup> <PropertyGroup> <DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets> <!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. --> <DefaultCoreClrSubsets Condition="'$(PrimaryRuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets> <DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(MonoAOTLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(TargetOS)' == 'Browser'">$(DefaultMonoSubsets)mono.wasmruntime+</DefaultMonoSubsets> <DefaultMonoSubsets Condition="'$(MonoCrossAOTTargetOS)' != ''">$(DefaultMonoSubsets)mono.aotcross+</DefaultMonoSubsets> <DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages</DefaultMonoSubsets> <DefaultLibrariesSubsets Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == '' or '$(BuildAllConfigurations)' == 'true'">libs.native+</DefaultLibrariesSubsets> <DefaultLibrariesSubsets>$(DefaultLibrariesSubsets)libs.sfx+libs.oob+libs.pretest</DefaultLibrariesSubsets> <DefaultHostSubsets>host.native+host.tools</DefaultHostSubsets> <DefaultHostSubsets Condition="'$(DotNetBuildFromSource)' != 'true'">$(DefaultHostSubsets)+host.pkg+host.tests</DefaultHostSubsets> <DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)'"></DefaultHostSubsets> <DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'">host.native</DefaultHostSubsets> <DefaultPacksSubsets>packs.product</DefaultPacksSubsets> <DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and '$(DotNetBuildFromSource)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets> <DefaultPacksSubsets Condition="'$(DotNetBuildFromSource)' == 'true'">$(DefaultPacksSubsets)+packs.installers</DefaultPacksSubsets> </PropertyGroup> <PropertyGroup> <_subset>$(_subset.Replace('+clr.paltests+', '+clr.paltests+clr.paltestlist+'))</_subset> <_subset>$(_subset.Replace('+clr+', '+$(DefaultCoreClrSubsets)+'))</_subset> <_subset>$(_subset.Replace('+mono+', '+$(DefaultMonoSubsets)+'))</_subset> <_subset>$(_subset.Replace('+libs+', '+$(DefaultLibrariesSubsets)+'))</_subset> <_subset>$(_subset.Replace('+host+', '+$(DefaultHostSubsets)+'))</_subset> <_subset>$(_subset.Replace('+packs+', '+$(DefaultPacksSubsets)+'))</_subset> <!-- Surround _subset in dashes to simplify checks below --> <_subset>+$(_subset.Trim('+'))+</_subset> <ClrRuntimeBuildSubsets></ClrRuntimeBuildSubsets> <ClrDefaultRuntimeBuildSubsets>ClrRuntimeSubset=true;ClrJitSubset=true;ClrILToolsSubset=true</ClrDefaultRuntimeBuildSubsets> </PropertyGroup> <ItemGroup> <!-- CoreClr --> <SubsetName Include="Clr" Description="The full CoreCLR runtime. Equivalent to: $(DefaultCoreClrSubsets)" /> <SubsetName Include="Clr.NativePrereqs" Description="Managed tools that support building the native components of the runtime (such as DacTableGen)." /> <SubsetName Include="Clr.ILTools" Description="The CoreCLR IL tools (ilasm/ildasm)." /> <SubsetName Include="Clr.Runtime" Description="The CoreCLR .NET runtime. Includes clr.jit, clr.iltools, clr.hosts." /> <SubsetName Include="Clr.Native" Description="All CoreCLR native non-test components, including the runtime, jits, and other native tools. Includes clr.hosts, clr.runtime, clr.jit, clr.alljits, clr.paltests, clr.iltools, clr.nativeaotruntime, clr.spmi." /> <SubsetName Include="Clr.NativeAotLibs" Description="The CoreCLR native AOT CoreLib and other low level class libraries." /> <SubsetName Include="Clr.NativeAotRuntime" Description="The stripped-down CoreCLR native AOT runtime." /> <SubsetName Include="Clr.CrossArchTools" Description="The cross-targetted CoreCLR tools." /> <SubsetName Include="Clr.PalTests" OnDemand="true" Description="The CoreCLR PAL tests." /> <SubsetName Include="Clr.PalTestList" OnDemand="true" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." /> <SubsetName Include="Clr.Hosts" Description="The CoreCLR corerun test host." /> <SubsetName Include="Clr.Jit" Description="The JIT for the CoreCLR .NET runtime." /> <SubsetName Include="Clr.AllJits" Description="All of the cross-targeting JIT compilers for the CoreCLR .NET runtime." /> <SubsetName Include="Clr.Spmi" Description="SuperPMI, a tool for CoreCLR JIT testing." /> <SubsetName Include="Clr.CoreLib" Description="The managed System.Private.CoreLib library for CoreCLR." /> <SubsetName Include="Clr.NativeCoreLib" Description="Run crossgen on System.Private.CoreLib library for CoreCLR." /> <SubsetName Include="Clr.Tools" Description="Managed tools that support CoreCLR development and testing." /> <SubsetName Include="Clr.ToolsTests" OnDemand="true" Description="Unit tests for the clr.tools subset." /> <SubsetName Include="Clr.Packages" Description="The projects that produce NuGet packages for the CoreCLR runtime, crossgen, and IL tools." /> <SubsetName Include="LinuxDac" Condition="$([MSBuild]::IsOsPlatform(Windows))" Description="The cross-OS Windows->libc-based Linux DAC. Skipped on x86." /> <SubsetName Include="AlpineDac" Condition="$([MSBuild]::IsOsPlatform(Windows))" OnDemand="true" Description="The cross-OS Windows->musl-libc-based Linux DAC. Skipped on x86" /> <SubsetName Include="CrossDacPack" OnDemand="true" Description="Packaging of cross OS DAC. Requires all assets needed to be present at a folder specified by $(CrossDacArtifactsDir). See 'Microsoft.CrossOsDiag.Private.CoreCLR.proj' for details." /> <!-- Mono --> <SubsetName Include="Mono" Description="The Mono runtime and CoreLib. Equivalent to: $(DefaultMonoSubsets)" /> <SubsetName Include="Mono.Runtime" Description="The Mono .NET runtime." /> <SubsetName Include="Mono.AotCross" Description="The cross-compiler runtime for Mono AOT." /> <SubsetName Include="Mono.CoreLib" Description="The managed System.Private.CoreLib library for Mono." /> <SubsetName Include="Mono.Packages" Description="The projects that produce NuGet packages for the Mono runtime." /> <SubsetName Include="Mono.WasmRuntime" Description="The WebAssembly runtime." /> <SubsetName Include="Mono.MsCorDbi" Description="The implementation of ICorDebug interface." /> <SubsetName Include="Mono.Workloads" OnDemand="true" Description="Builds the installers and the insertion metadata for Blazor workloads." /> <!-- Host --> <SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests. Equivalent to: $(DefaultHostSubsets)" /> <SubsetName Include="Host.Native" Description="The .NET hosts." /> <SubsetName Include="Host.Pkg" Description="The .NET host packages." /> <SubsetName Include="Host.Tools" Description="The .NET hosting libraries." /> <SubsetName Include="Host.Tests" Description="The .NET hosting tests." /> <!-- Libs --> <SubsetName Include="Libs" Description="The libraries native part, refs and source assemblies, test infra and packages, but NOT the tests (use Libs.Tests to request those explicitly). Equivalent to: $(DefaultLibrariesSubsets)" /> <SubsetName Include="Libs.Native" Description="The native libraries used in the shared framework." /> <SubsetName Include="Libs.Sfx" Description="The managed shared framework libraries." /> <SubsetName Include="Libs.Oob" Description="The managed out-of-band libraries." /> <SubsetName Include="Libs.Ref" OnDemand="true" Description="The managed reference libraries." /> <SubsetName Include="Libs.Src" OnDemand="true" Description="The managed implementation libraries." /> <SubsetName Include="Libs.PreTest" Description="Test assets which are necessary to run tests." /> <SubsetName Include="Libs.Packages" Description="The projects that produce NuGet packages from libraries." /> <SubsetName Include="Libs.Tests" OnDemand="true" Description="The test projects. Note that building this doesn't execute tests: you must also pass the '-test' argument." /> <!-- Packs --> <SubsetName Include="Packs" Description="Builds the shared framework packs, archives, bundles, installers, and the framework pack tests. Equivalent to: $(DefaultPacksSubsets)" /> <SubsetName Include="Packs.Product" Description="Builds the shared framework packs, archives, bundles, and installers." /> <SubsetName Include="Packs.Installers" Description="Builds the shared framework bundles and installers." /> <SubsetName Include="Packs.Tests" Description="The framework pack tests." /> <!-- Utility --> <SubsetName Include="publish" OnDemand="true" Description="Generate asset manifests and prepare to publish to BAR." /> <SubsetName Include="RegenerateDownloadTable" OnDemand="true" Description="Regenerates the nightly build download table" /> <SubsetName Include="RegenerateThirdPartyNotices" OnDemand="true" Description="Regenerates the THIRD-PARTY-NOTICES.TXT file based on other repos' TPN files." /> </ItemGroup> <!-- Default targets, parallelization and configurations. --> <ItemDefinitionGroup> <ProjectToBuild> <Test>false</Test> <Pack>false</Pack> <Publish>false</Publish> <BuildInParallel>false</BuildInParallel> </ProjectToBuild> </ItemDefinitionGroup> <!-- CoreClr sets --> <ItemGroup Condition="$(_subset.Contains('+clr.corelib+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="clr" /> </ItemGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.hosts+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrHostsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.runtime+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.native+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrFullNativeBuild=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.jit+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrJitSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.paltests+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrPalTestsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.alljits+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.iltools+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrILToolsSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.nativeaotruntime+')) and '$(NativeAotSupported)' == 'true'"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrNativeAotSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <PropertyGroup Condition="$(_subset.Contains('+clr.spmi+'))"> <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrSpmiSubset=true</ClrRuntimeBuildSubsets> </PropertyGroup> <ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != '' or $(_subset.Contains('+clr.nativeprereqs+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime-prereqs.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != ''"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties);$(ClrRuntimeBuildSubsets)" Category="clr" /> </ItemGroup> <!-- Build the CoreCLR cross-arch tools when we're doing a cross-architecture build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them --> <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and '$(BuildArchitecture)' != '$(TargetArchitecture)'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(BuildArchitecture); PgoInstrument=false; NoPgoOptimize=true; CrossBuild=false; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' == 'x64'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=x86; PgoInstrument=false; NoPgoOptimize=true; CrossBuild=false; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.paltestlist+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)pal/tests/palsuite/producepaltestlist.proj" /> </ItemGroup> <PropertyGroup> <CrossDacHostArch>x64</CrossDacHostArch> <CrossDacHostArch Condition="'$(TargetArchitecture)' == 'arm'">x86</CrossDacHostArch> </PropertyGroup> <ItemGroup Condition="$(_subset.Contains('+linuxdac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(CrossDacHostArch); PgoInstrument=false; NoPgoOptimize=true; TargetOS=Linux; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+alpinedac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'"> <ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties); ClrCrossComponentsSubset=true; HostArchitecture=$(CrossDacHostArch); PgoInstrument=false; NoPgoOptimize=true; TargetOS=alpine; CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+crossdacpack+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot).nuget\Microsoft.CrossOsDiag.Private.CoreCLR\Microsoft.CrossOsDiag.Private.CoreCLR.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.tools+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\runincontext\runincontext.csproj; $(CoreClrProjectRoot)tools\tieringtest\tieringtest.csproj; $(CoreClrProjectRoot)tools\r2rdump\R2RDump.csproj; $(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo.csproj; $(CoreClrProjectRoot)tools\aot\ILCompiler\repro\repro.csproj; $(CoreClrProjectRoot)tools\r2rtest\R2RTest.csproj" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Build.Tasks\ILCompiler.Build.Tasks.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" /> <ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.toolstests+'))"> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj" Test="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Compiler.Tests\ILCompiler.Compiler.Tests.csproj" Test="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(NativeAotSupported)' == 'true'"/> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.nativecorelib+'))"> <!-- Build crossgen2 that will be used to compile System.Private.CoreLib library for CoreCLR --> <ProjectToBuild Condition="'$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> <ProjectToBuild Condition="!('$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64')" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.packages+')) and '$(PgoInstrument)' != 'true'"> <ProjectToBuild Include="$(CoreClrProjectRoot).nuget\coreclr-packages.proj" Pack="true" Category="clr" /> <ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo-pack.proj" Pack="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(RuntimeFlavor)' != 'Mono'"/> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+clr.nativeaotlibs+')) and '$(NativeAotSupported)' == 'true'"> <ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\**\src\*.csproj" Category="clr" /> </ItemGroup> <!-- Mono sets --> <ItemGroup Condition="$(_subset.Contains('+mono.llvm+')) or $(_subset.Contains('+mono.aotcross+')) or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'Browser'"> <ProjectToBuild Include="$(MonoProjectRoot)llvm\llvm-init.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.packages+'))"> <ProjectToBuild Include="$(MonoProjectRoot)nuget\mono-packages.proj" Category="mono" Pack="true" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.runtime+'))"> <ProjectToBuild Include="$(MonoProjectRoot)mono.proj" AdditionalProperties="%(AdditionalProperties);MonoMsCorDbi=$(_subset.Contains('+mono.mscordbi+'))" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.aotcross+'))"> <ProjectToBuild Include="$(MonoProjectRoot)monoaotcross.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.corelib+'))"> <ProjectToBuild Include="$(MonoProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.workloads+'))"> <ProjectToBuild Include="$(WorkloadsProjectRoot)\workloads.csproj" Category="mono" /> </ItemGroup> <!-- Host sets --> <ItemGroup Condition="$(_subset.Contains('+host.native+'))"> <CorehostProjectToBuild Include="$(SharedNativeRoot)corehost\corehost.proj" SignPhase="Binaries" /> <ProjectToBuild Include="@(CorehostProjectToBuild)" Pack="true" Category="host" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+host.tools+'))"> <ManagedProjectToBuild Include="$(InstallerProjectRoot)managed\**\*.csproj" SignPhase="Binaries" /> <ProjectToBuild Include="@(ManagedProjectToBuild)" BuildInParallel="true" Pack="true" Category="host" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(PgoInstrument)' != 'true'"> <PkgprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\host-packages.proj" SignPhase="MsiFiles" /> <ProjectToBuild Include="@(PkgprojProjectToBuild)" Pack="true" Category="host" /> </ItemGroup> <!-- Libraries sets --> <ItemGroup Condition="$(_subset.Contains('+libs.native+'))"> <ProjectToBuild Include="$(SharedNativeRoot)libs\build-native.proj" Category="libs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.ref+')) or $(_subset.Contains('+libs.src+')) or $(_subset.Contains('+libs.sfx+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)sfx.proj" Category="libs" Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == '' or '$(BuildAllConfigurations)' == 'true'"> <AdditionalProperties Condition="$(_subset.Contains('+libs.ref+'))">%(AdditionalProperties);RefOnly=true</AdditionalProperties> </ProjectToBuild> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.ref+')) or $(_subset.Contains('+libs.src+')) or $(_subset.Contains('+libs.oob+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)oob.proj" Category="libs"> <AdditionalProperties Condition="$(_subset.Contains('+libs.ref+'))">%(AdditionalProperties);RefOnly=true</AdditionalProperties> </ProjectToBuild> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+mono.wasmruntime+'))"> <ProjectToBuild Include="$(MonoProjectRoot)wasm\wasm.proj" Category="mono" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.pretest+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)pretest.proj" Category="libs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+libs.tests+'))"> <ProjectToBuild Include="$(LibrariesProjectRoot)tests.proj" Category="libs" Test="true" /> </ItemGroup> <!-- Host.tests subset (consumes live built libraries assets so needs to come after libraries) --> <ItemGroup Condition="$(_subset.Contains('+host.tests+'))"> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\AppHost.Bundle.Tests\AppHost.Bundle.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.AppHost.Tests\Microsoft.NET.HostModel.AppHost.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.Bundle.Tests\Microsoft.NET.HostModel.Bundle.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.NET.HostModel.Tests\Microsoft.NET.HostModel.ComHost.Tests\Microsoft.NET.HostModel.ComHost.Tests.csproj" /> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\HostActivation.Tests\HostActivation.Tests.csproj" /> <ProjectToBuild Include="@(TestProjectToBuild)" BuildInParallel="true" Test="true" Category="host" /> </ItemGroup> <!-- Packs sets --> <Choose> <When Condition="$(_subset.Contains('+packs.product+'))"> <ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'"> <SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.Composite.sfxproj" /> <SharedFrameworkProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Composite.Bundle.bundleproj" /> </ItemGroup> <ItemGroup Condition="'$(PgoInstrument)' != 'true'"> <SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\archives\dotnet-nethost.proj" /> <SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" /> <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)\pkg\projects\nativeaot-packages.proj" Category="packs" /> </ItemGroup> <ItemGroup> <SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" /> <SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" /> <ProjectToBuild Include="@(SharedFrameworkProjectToBuild)" Category="packs" /> </ItemGroup> </When> </Choose> <ItemGroup Condition="$(_subset.Contains('+packs.installers+')) AND '$(PgoInstrument)' != 'true'"> <InstallerProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\installers.proj" /> <ProjectToBuild Include="@(InstallerProjectToBuild)" Category="packs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+packs.tests+')) AND '$(PgoInstrument)' != 'true'"> <TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.DotNet.CoreSetup.Packaging.Tests\Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj" /> <ProjectToBuild Include="@(TestProjectToBuild)" BuildInParallel="true" Test="true" Category="packs" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('+publish+'))"> <ProjectToBuild Include="$(InstallerProjectRoot)prepare-artifacts.proj" Pack="true" Category="publish" /> </ItemGroup> <!-- Utility --> <ItemGroup Condition="$(_subset.Contains('+regeneratedownloadtable+'))"> <ProjectToBuild Include="$(RepositoryEngineeringDir)regenerate-download-table.proj" Pack="true" /> </ItemGroup> <ItemGroup Condition="$(_subset.Contains('regeneratethirdpartynotices'))"> <ProjectToBuild Include="$(RepositoryEngineeringDir)regenerate-third-party-notices.proj" Pack="false" BuildInParallel="false" /> </ItemGroup> <!-- Set default configurations. --> <ItemGroup> <ProjectToBuild Update="@(ProjectToBuild)"> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'clr' and '$(CoreCLRConfiguration)' != ''">%(AdditionalProperties);Configuration=$(CoreCLRConfiguration)</AdditionalProperties> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'mono' and '$(MonoConfiguration)' != ''">%(AdditionalProperties);Configuration=$(MonoConfiguration)</AdditionalProperties> <AdditionalProperties Condition="'%(ProjectToBuild.Category)' == 'libs' and '$(LibrariesConfiguration)' != ''">%(AdditionalProperties);Configuration=$(LibrariesConfiguration)</AdditionalProperties> </ProjectToBuild> </ItemGroup> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./eng/liveBuilds.targets
<Project> <!-- Accept override paths for live artifacts. --> <PropertyGroup> <CoreCLRArtifactsPath Condition="'$(CoreCLROverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(MonoOverridePath)'))</MonoArtifactsPath> <LibrariesArtifactsPath Condition="'$(LibrariesOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(LibrariesOverridePath)'))</LibrariesArtifactsPath> <LibrariesAllConfigurationsArtifactsPath Condition="'$(LibrariesAllConfigurationsOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigurationsOverridePath)'))</LibrariesAllConfigurationsArtifactsPath> <!-- Honor the RuntimeArtifactsPath property. --> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == '' and '$(RuntimeArtifactsPath)' != ''">$([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoArtifactsPath)' == '' and '$(RuntimeArtifactsPath)' != ''">$([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)'))</MonoArtifactsPath> <LibrariesTargetOSConfigurationArchitecture Condition="'$(LibrariesTargetOSConfigurationArchitecture)' == ''">$(TargetOS)-$(LibrariesConfiguration)-$(TargetArchitecture)</LibrariesTargetOSConfigurationArchitecture> </PropertyGroup> <!-- Set up default live asset paths if no overrides provided. --> <PropertyGroup> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'mono', '$(TargetOS).$(TargetArchitecture).$(MonoConfiguration)'))</MonoArtifactsPath> <LibrariesArtifactsPath Condition="'$(LibrariesArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts'))</LibrariesArtifactsPath> <LibrariesAllConfigurationsArtifactsPath Condition="'$(LibrariesAllConfigurationsArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts'))</LibrariesAllConfigurationsArtifactsPath> </PropertyGroup> <!-- Set up artifact subpaths. --> <PropertyGroup> <CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir> <CoreCLRCrossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))</CoreCLRCrossgen2Dir> <CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc'))</CoreCLRILCompilerDir> <CoreCLRCrossILCompilerDir Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir> <CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir> <CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir> <MonoAotCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())))</MonoAotCrossDir> <LibrariesPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'packages', '$(LibrariesConfiguration)'))</LibrariesPackagesDir> <LibrariesShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesPackagesDir)', 'Shipping'))</LibrariesShippingPackagesDir> <LibrariesNonShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesPackagesDir)', 'NonShipping'))</LibrariesNonShippingPackagesDir> <LibrariesAllConfigPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigurationsArtifactsPath)', 'packages', '$(LibrariesConfiguration)'))</LibrariesAllConfigPackagesDir> <LibrariesAllConfigShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigPackagesDir)', 'Shipping'))</LibrariesAllConfigShippingPackagesDir> <LibrariesAllConfigNonShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigPackagesDir)', 'NonShipping'))</LibrariesAllConfigNonShippingPackagesDir> <LibrariesSharedFrameworkRefArtifactsPath Condition="'$(LibrariesSharedFrameworkRefArtifactsPath)' == ''">$(MicrosoftNetCoreAppRefPackRefDir)</LibrariesSharedFrameworkRefArtifactsPath> <LibrariesAllRefArtifactsPath Condition="'$(LibrariesAllRefArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'ref', '$(NetCoreAppCurrent)'))</LibrariesAllRefArtifactsPath> <LibrariesSharedFrameworkBinArtifactsPath Condition="'$(LibrariesSharedFrameworkBinArtifactsPath)' == ''">$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</LibrariesSharedFrameworkBinArtifactsPath> <LibrariesAllBinArtifactsPath Condition="'$(LibrariesAllBinArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'runtime'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\</LibrariesAllBinArtifactsPath> <LibrariesNativeArtifactsPath Condition="'$(LibrariesNativeArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'native'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\</LibrariesNativeArtifactsPath> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">x64</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsWindows)' == 'true'">x86</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'armel' and '$(BuildArchitecture)' != 'armel' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> </PropertyGroup> <Target Name="ResolveRuntimeFilesFromLocalBuild"> <Error Condition="!Exists('$(CoreCLRArtifactsPath)') and '$(RuntimeFlavor)' == 'CoreCLR'" Text="The CoreCLR artifacts path does not exist '$(CoreCLRArtifactsPath)'. The 'clr' subset must be built before building this project. Configuration: '$(CoreCLRConfiguration)'. To use a different configuration, specify the 'RuntimeConfiguration' property." /> <Error Condition="!Exists('$(MonoArtifactsPath)') and '$(RuntimeFlavor)' == 'Mono'" Text="The Mono artifacts path does not exist '$(MonoArtifactsPath)'. The 'mono' subset must be built before building this project. Configuration: '$(MonoConfiguration)'. To use a different configuration, specify the 'RuntimeConfiguration' property." /> <PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'"> <CoreCLRArtifactsPath>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)'))</CoreCLRArtifactsPath> <CoreCLRArtifactsPdbDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','PDB'))</CoreCLRArtifactsPdbDir> <!-- Even though CoreCLRSharedFrameworkDir is statically initialized, set it again in case the value is different after CoreCLRArtifactsPath is normalized. --> <CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework'))</CoreCLRSharedFrameworkDir> <CoreCLRSharedFrameworkPdbDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB'))</CoreCLRSharedFrameworkPdbDir> <CoreCLRCrossTargetComponentDir Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir> </PropertyGroup> <PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'"> <MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)'))</MonoArtifactsPath> </PropertyGroup> <ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'"> <RuntimeFiles Include="$(CoreCLRSharedFrameworkDir)*.*" /> <RuntimeFiles Condition="'$(PgoInstrument)' == 'true'" Include="$(CoreCLRSharedFrameworkDir)PGD/*" /> <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include="$(CoreCLRCrossTargetComponentDir)*.*" IsNative="true" /> <RuntimeFiles> <IsNative>true</IsNative> </RuntimeFiles> <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)System.Private.CoreLib.dll')" /> <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll') and '@(_systemPrivateCoreLib)' == ''" /> <RuntimeFiles Include="@(_systemPrivateCoreLib)" /> <RuntimeFiles Include=" $(CoreCLRSharedFrameworkPdbDir)*.pdb; $(CoreCLRSharedFrameworkPdbDir)*.dbg; $(CoreCLRSharedFrameworkPdbDir)*.dwarf" IsNative="true" /> <RuntimeFiles Condition="Exists('$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.pdb')" Include="$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.pdb" /> <RuntimeFiles Condition="Exists('$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.ni.pdb')" Include="$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.ni.pdb" /> <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include=" $(CoreCLRSharedFrameworkPdbDir)*.pdb; $(CoreCLRSharedFrameworkPdbDir)*.dbg; $(CoreCLRSharedFrameworkPdbDir)*.dwarf" /> <CoreCLRCrossTargetFiles> <TargetPath>runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath> <IsNative>true</IsNative> </CoreCLRCrossTargetFiles> </ItemGroup> <ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'"> <RuntimeFiles Include="$(MonoArtifactsPath)\*.*" /> <RuntimeFiles> <IsNative>true</IsNative> </RuntimeFiles> <FrameworkReleaseFiles Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" Include="$(MonoArtifactsPath)\Mono.release.framework\*.*" /> <FrameworkDebugFiles Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" Include="$(MonoArtifactsPath)\Mono.debug.framework\*.*" /> <MonoIncludeFiles Condition="'$(TargetsMobile)' == 'true'" Include="$(MonoArtifactsPath)\include\**\*.*" /> </ItemGroup> <Error Condition="'@(RuntimeFiles)' == ''" Text="The '$(RuntimeFlavor)' subset must be built before building this project." /> </Target> <Target Name="EnsureLocalArtifactsExist"> <Error Condition="!Exists('$(LibrariesSharedFrameworkRefArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesSharedFrameworkRefArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="'$(IncludeOOBLibraries)' == 'true' and !Exists('$(LibrariesAllRefArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesAllRefArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> </Target> <!-- Ensure artifacts exist for the more advanced paths. If the configuration is '*', don't emit these errors: it isn't a local dev scenario. --> <Target Name="EnsureLocalOSGroupConfigurationArchitectureSpecificArtifactsExist" Condition="'$(LibrariesTargetOSConfigurationArchitecture)' != '*'"> <Error Condition="!Exists('$(LibrariesSharedFrameworkBinArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesSharedFrameworkBinArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="'$(IncludeOOBLibraries)' == 'true' and !Exists('$(LibrariesAllBinArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesAllBinArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="!Exists('$(LibrariesNativeArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesNativeArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> </Target> <Target Name="ResolveLibrariesRefAssembliesFromLocalBuild" DependsOnTargets="EnsureLocalArtifactsExist"> <ItemGroup> <LibrariesRefAssemblies Condition="'$(IncludeOOBLibraries)' != 'true'" Include="$(LibrariesSharedFrameworkRefArtifactsPath)*.dll;$(LibrariesSharedFrameworkRefArtifactsPath)*.pdb" /> <LibrariesRefAssemblies Condition="'$(IncludeOOBLibraries)' == 'true'" Include="$(LibrariesAllRefArtifactsPath)*.dll;$(LibrariesAllRefArtifactsPath)*.pdb" /> </ItemGroup> <Error Condition="'@(LibrariesRefAssemblies)' == ''" Text="The 'libs' subset must be built before building this project." /> </Target> <Target Name="ResolveLibrariesRuntimeFilesFromLocalBuild" DependsOnTargets=" EnsureLocalArtifactsExist; EnsureLocalOSGroupConfigurationArchitectureSpecificArtifactsExist"> <ItemGroup> <LibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' != 'true'" Include=" $(LibrariesSharedFrameworkBinArtifactsPath)*.dll; $(LibrariesSharedFrameworkBinArtifactsPath)*.pdb" IsNative="" /> <LibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' == 'true'" Include=" $(LibrariesAllBinArtifactsPath)*.dll; $(LibrariesAllBinArtifactsPath)*.pdb" IsNative="" /> <ExcludeNativeLibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' != 'true'" Include="$(LibrariesNativeArtifactsPath)libSystem.IO.Ports.Native.*" /> <LibrariesRuntimeFiles Include=" $(LibrariesNativeArtifactsPath)*.dll; $(LibrariesNativeArtifactsPath)*.dylib; $(LibrariesNativeArtifactsPath)*.a; $(LibrariesNativeArtifactsPath)*.so; $(LibrariesNativeArtifactsPath)*.dbg; $(LibrariesNativeArtifactsPath)*.dwarf; $(LibrariesNativeArtifactsPath)*.pdb" IsNative="true" Exclude="@(ExcludeNativeLibrariesRuntimeFiles)" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)dotnet.js; $(LibrariesNativeArtifactsPath)dotnet.d.ts; $(LibrariesNativeArtifactsPath)package.json; $(LibrariesNativeArtifactsPath)dotnet.wasm; $(LibrariesNativeArtifactsPath)dotnet.js.symbols; $(LibrariesNativeArtifactsPath)dotnet.timezones.blat; $(LibrariesNativeArtifactsPath)*.dat;" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)src\*.c; $(LibrariesNativeArtifactsPath)src\*.js; $(LibrariesNativeArtifactsPath)src\emcc-default.rsp; $(LibrariesNativeArtifactsPath)src\emcc-link.rsp; $(LibrariesNativeArtifactsPath)src\emcc-props.json;" NativeSubDirectory="src" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include="$(LibrariesNativeArtifactsPath)src\cjs\*.js" NativeSubDirectory="src\cjs" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include="$(LibrariesNativeArtifactsPath)src\es6\*.js" NativeSubDirectory="src\es6" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)include\wasm\*.h;" NativeSubDirectory="include\wasm" IsNative="true" /> </ItemGroup> <Error Condition="'@(LibrariesRuntimeFiles)' == ''" Text="The 'libs' subset must be built before building this project." /> </Target> <Target Name="ResolveLibrariesFromLocalBuild" DependsOnTargets=" ResolveLibrariesRefAssembliesFromLocalBuild; ResolveLibrariesRuntimeFilesFromLocalBuild" /> <PropertyGroup> <BundledRuntimeIdentifierGraphFile>$(RuntimeIdGraphDefinitionFile)</BundledRuntimeIdentifierGraphFile> </PropertyGroup> </Project>
<Project> <!-- Accept override paths for live artifacts. --> <PropertyGroup> <CoreCLRArtifactsPath Condition="'$(CoreCLROverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(MonoOverridePath)'))</MonoArtifactsPath> <LibrariesArtifactsPath Condition="'$(LibrariesOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(LibrariesOverridePath)'))</LibrariesArtifactsPath> <LibrariesAllConfigurationsArtifactsPath Condition="'$(LibrariesAllConfigurationsOverridePath)' != ''">$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigurationsOverridePath)'))</LibrariesAllConfigurationsArtifactsPath> <!-- Honor the RuntimeArtifactsPath property. --> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == '' and '$(RuntimeArtifactsPath)' != ''">$([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoArtifactsPath)' == '' and '$(RuntimeArtifactsPath)' != ''">$([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)'))</MonoArtifactsPath> <LibrariesTargetOSConfigurationArchitecture Condition="'$(LibrariesTargetOSConfigurationArchitecture)' == ''">$(TargetOS)-$(LibrariesConfiguration)-$(TargetArchitecture)</LibrariesTargetOSConfigurationArchitecture> </PropertyGroup> <!-- Set up default live asset paths if no overrides provided. --> <PropertyGroup> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)'))</CoreCLRArtifactsPath> <MonoArtifactsPath Condition="'$(MonoArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'mono', '$(TargetOS).$(TargetArchitecture).$(MonoConfiguration)'))</MonoArtifactsPath> <LibrariesArtifactsPath Condition="'$(LibrariesArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts'))</LibrariesArtifactsPath> <LibrariesAllConfigurationsArtifactsPath Condition="'$(LibrariesAllConfigurationsArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts'))</LibrariesAllConfigurationsArtifactsPath> </PropertyGroup> <!-- Set up artifact subpaths. --> <PropertyGroup> <CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir> <CoreCLRCrossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))</CoreCLRCrossgen2Dir> <CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc'))</CoreCLRILCompilerDir> <CoreCLRCrossILCompilerDir Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir> <CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir> <CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir> <MonoAotCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())))</MonoAotCrossDir> <LibrariesPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'packages', '$(LibrariesConfiguration)'))</LibrariesPackagesDir> <LibrariesShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesPackagesDir)', 'Shipping'))</LibrariesShippingPackagesDir> <LibrariesNonShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesPackagesDir)', 'NonShipping'))</LibrariesNonShippingPackagesDir> <LibrariesAllConfigPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigurationsArtifactsPath)', 'packages', '$(LibrariesConfiguration)'))</LibrariesAllConfigPackagesDir> <LibrariesAllConfigShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigPackagesDir)', 'Shipping'))</LibrariesAllConfigShippingPackagesDir> <LibrariesAllConfigNonShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesAllConfigPackagesDir)', 'NonShipping'))</LibrariesAllConfigNonShippingPackagesDir> <LibrariesSharedFrameworkRefArtifactsPath Condition="'$(LibrariesSharedFrameworkRefArtifactsPath)' == ''">$(MicrosoftNetCoreAppRefPackRefDir)</LibrariesSharedFrameworkRefArtifactsPath> <LibrariesAllRefArtifactsPath Condition="'$(LibrariesAllRefArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'ref', '$(NetCoreAppCurrent)'))</LibrariesAllRefArtifactsPath> <LibrariesSharedFrameworkBinArtifactsPath Condition="'$(LibrariesSharedFrameworkBinArtifactsPath)' == ''">$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</LibrariesSharedFrameworkBinArtifactsPath> <LibrariesAllBinArtifactsPath Condition="'$(LibrariesAllBinArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'runtime'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\</LibrariesAllBinArtifactsPath> <LibrariesNativeArtifactsPath Condition="'$(LibrariesNativeArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'native'))$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)\</LibrariesNativeArtifactsPath> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">x64</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsWindows)' == 'true'">x86</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' != 'arm' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> <CoreCLRCrossTargetComponentDirName Condition="'$(TargetArchitecture)' == 'armel' and '$(BuildArchitecture)' != 'armel' and '$(TargetsLinux)' == 'true'">x64</CoreCLRCrossTargetComponentDirName> <SingleFileHostSourcePath>$(CoreCLRArtifactsPath)/corehost/singlefilehost$(ExeSuffix)</SingleFileHostSourcePath> </PropertyGroup> <Target Name="ResolveRuntimeFilesFromLocalBuild"> <Error Condition="!Exists('$(CoreCLRArtifactsPath)') and '$(RuntimeFlavor)' == 'CoreCLR'" Text="The CoreCLR artifacts path does not exist '$(CoreCLRArtifactsPath)'. The 'clr' subset must be built before building this project. Configuration: '$(CoreCLRConfiguration)'. To use a different configuration, specify the 'RuntimeConfiguration' property." /> <Error Condition="!Exists('$(MonoArtifactsPath)') and '$(RuntimeFlavor)' == 'Mono'" Text="The Mono artifacts path does not exist '$(MonoArtifactsPath)'. The 'mono' subset must be built before building this project. Configuration: '$(MonoConfiguration)'. To use a different configuration, specify the 'RuntimeConfiguration' property." /> <PropertyGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'"> <CoreCLRArtifactsPath>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)'))</CoreCLRArtifactsPath> <CoreCLRArtifactsPdbDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','PDB'))</CoreCLRArtifactsPdbDir> <!-- Even though CoreCLRSharedFrameworkDir is statically initialized, set it again in case the value is different after CoreCLRArtifactsPath is normalized. --> <CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework'))</CoreCLRSharedFrameworkDir> <CoreCLRSharedFrameworkPdbDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB'))</CoreCLRSharedFrameworkPdbDir> <CoreCLRCrossTargetComponentDir Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir> </PropertyGroup> <PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'"> <MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)'))</MonoArtifactsPath> </PropertyGroup> <ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'"> <RuntimeFiles Include="$(CoreCLRSharedFrameworkDir)*.*" /> <RuntimeFiles Condition="'$(PgoInstrument)' == 'true'" Include="$(CoreCLRSharedFrameworkDir)PGD/*" /> <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include="$(CoreCLRCrossTargetComponentDir)*.*" IsNative="true" /> <RuntimeFiles> <IsNative>true</IsNative> </RuntimeFiles> <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)System.Private.CoreLib.dll')" /> <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll') and '@(_systemPrivateCoreLib)' == ''" /> <RuntimeFiles Include="@(_systemPrivateCoreLib)" /> <RuntimeFiles Include=" $(CoreCLRSharedFrameworkPdbDir)*.pdb; $(CoreCLRSharedFrameworkPdbDir)*.dbg; $(CoreCLRSharedFrameworkPdbDir)*.dwarf" IsNative="true" /> <RuntimeFiles Condition="Exists('$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.pdb')" Include="$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.pdb" /> <RuntimeFiles Condition="Exists('$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.ni.pdb')" Include="$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.ni.pdb" /> <CoreCLRCrossTargetFiles Condition="'$(CoreCLRCrossTargetComponentDir)' != ''" Include=" $(CoreCLRSharedFrameworkPdbDir)*.pdb; $(CoreCLRSharedFrameworkPdbDir)*.dbg; $(CoreCLRSharedFrameworkPdbDir)*.dwarf" /> <CoreCLRCrossTargetFiles> <TargetPath>runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath> <IsNative>true</IsNative> </CoreCLRCrossTargetFiles> </ItemGroup> <ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'"> <RuntimeFiles Include="$(MonoArtifactsPath)\*.*" /> <RuntimeFiles> <IsNative>true</IsNative> </RuntimeFiles> <FrameworkReleaseFiles Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" Include="$(MonoArtifactsPath)\Mono.release.framework\*.*" /> <FrameworkDebugFiles Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" Include="$(MonoArtifactsPath)\Mono.debug.framework\*.*" /> <MonoIncludeFiles Condition="'$(TargetsMobile)' == 'true'" Include="$(MonoArtifactsPath)\include\**\*.*" /> </ItemGroup> <Error Condition="'@(RuntimeFiles)' == ''" Text="The '$(RuntimeFlavor)' subset must be built before building this project." /> </Target> <Target Name="EnsureLocalArtifactsExist"> <Error Condition="!Exists('$(LibrariesSharedFrameworkRefArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesSharedFrameworkRefArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="'$(IncludeOOBLibraries)' == 'true' and !Exists('$(LibrariesAllRefArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesAllRefArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> </Target> <!-- Ensure artifacts exist for the more advanced paths. If the configuration is '*', don't emit these errors: it isn't a local dev scenario. --> <Target Name="EnsureLocalOSGroupConfigurationArchitectureSpecificArtifactsExist" Condition="'$(LibrariesTargetOSConfigurationArchitecture)' != '*'"> <Error Condition="!Exists('$(LibrariesSharedFrameworkBinArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesSharedFrameworkBinArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="'$(IncludeOOBLibraries)' == 'true' and !Exists('$(LibrariesAllBinArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesAllBinArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> <Error Condition="!Exists('$(LibrariesNativeArtifactsPath)')" Text="The 'libs' subset must be built before building this project. Missing artifacts: $(LibrariesNativeArtifactsPath). Configuration: '$(LibrariesConfiguration)'. To use a different configuration, specify the 'LibrariesConfiguration' property." /> </Target> <Target Name="ResolveLibrariesRefAssembliesFromLocalBuild" DependsOnTargets="EnsureLocalArtifactsExist"> <ItemGroup> <LibrariesRefAssemblies Condition="'$(IncludeOOBLibraries)' != 'true'" Include="$(LibrariesSharedFrameworkRefArtifactsPath)*.dll;$(LibrariesSharedFrameworkRefArtifactsPath)*.pdb" /> <LibrariesRefAssemblies Condition="'$(IncludeOOBLibraries)' == 'true'" Include="$(LibrariesAllRefArtifactsPath)*.dll;$(LibrariesAllRefArtifactsPath)*.pdb" /> </ItemGroup> <Error Condition="'@(LibrariesRefAssemblies)' == ''" Text="The 'libs' subset must be built before building this project." /> </Target> <Target Name="ResolveLibrariesRuntimeFilesFromLocalBuild" DependsOnTargets=" EnsureLocalArtifactsExist; EnsureLocalOSGroupConfigurationArchitectureSpecificArtifactsExist"> <ItemGroup> <LibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' != 'true'" Include=" $(LibrariesSharedFrameworkBinArtifactsPath)*.dll; $(LibrariesSharedFrameworkBinArtifactsPath)*.pdb" IsNative="" /> <LibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' == 'true'" Include=" $(LibrariesAllBinArtifactsPath)*.dll; $(LibrariesAllBinArtifactsPath)*.pdb" IsNative="" /> <ExcludeNativeLibrariesRuntimeFiles Condition="'$(IncludeOOBLibraries)' != 'true'" Include="$(LibrariesNativeArtifactsPath)libSystem.IO.Ports.Native.*" /> <LibrariesRuntimeFiles Include=" $(LibrariesNativeArtifactsPath)*.dll; $(LibrariesNativeArtifactsPath)*.dylib; $(LibrariesNativeArtifactsPath)*.a; $(LibrariesNativeArtifactsPath)*.so; $(LibrariesNativeArtifactsPath)*.dbg; $(LibrariesNativeArtifactsPath)*.dwarf; $(LibrariesNativeArtifactsPath)*.pdb" IsNative="true" Exclude="@(ExcludeNativeLibrariesRuntimeFiles)" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)dotnet.js; $(LibrariesNativeArtifactsPath)dotnet.d.ts; $(LibrariesNativeArtifactsPath)package.json; $(LibrariesNativeArtifactsPath)dotnet.wasm; $(LibrariesNativeArtifactsPath)dotnet.js.symbols; $(LibrariesNativeArtifactsPath)dotnet.timezones.blat; $(LibrariesNativeArtifactsPath)*.dat;" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)src\*.c; $(LibrariesNativeArtifactsPath)src\*.js; $(LibrariesNativeArtifactsPath)src\emcc-default.rsp; $(LibrariesNativeArtifactsPath)src\emcc-link.rsp; $(LibrariesNativeArtifactsPath)src\emcc-props.json;" NativeSubDirectory="src" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include="$(LibrariesNativeArtifactsPath)src\cjs\*.js" NativeSubDirectory="src\cjs" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include="$(LibrariesNativeArtifactsPath)src\es6\*.js" NativeSubDirectory="src\es6" IsNative="true" /> <LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'" Include=" $(LibrariesNativeArtifactsPath)include\wasm\*.h;" NativeSubDirectory="include\wasm" IsNative="true" /> </ItemGroup> <Error Condition="'@(LibrariesRuntimeFiles)' == ''" Text="The 'libs' subset must be built before building this project." /> </Target> <Target Name="ResolveLibrariesFromLocalBuild" DependsOnTargets=" ResolveLibrariesRefAssembliesFromLocalBuild; ResolveLibrariesRuntimeFilesFromLocalBuild" /> <PropertyGroup> <BundledRuntimeIdentifierGraphFile>$(RuntimeIdGraphDefinitionFile)</BundledRuntimeIdentifierGraphFile> </PropertyGroup> <Target Name="RewriteRuntimePackDir" Condition="'$(RunningPublish)' == 'true'" DependsOnTargets="ResolveRuntimeFilesFromLocalBuild" BeforeTargets="ResolveRuntimePackAssets"> <ItemGroup> <!-- Remove AspNetCore runtime pack since we don't build it locally --> <ResolvedRuntimePack Remove="Microsoft.AspNetCore.App.Runtime.$(RuntimeIdentifier)" /> <ResolvedRuntimePack Update="Microsoft.NETCore.App.Runtime.$(RuntimeIdentifier)"> <PackageDirectory>$(MicrosoftNetCoreAppRuntimePackDir)</PackageDirectory> </ResolvedRuntimePack> </ItemGroup> </Target> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./eng/testing/tests.singlefile.targets
<Project> <PropertyGroup> <OutputType>Exe</OutputType> <DefineConstants>$(DefineConstants);SINGLE_FILE_TEST_RUNNER</DefineConstants> <BundleDir>$([MSBuild]::NormalizeDirectory('$(OutDir)', 'publish'))</BundleDir> <RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath> <RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier> <RunScriptCommand Condition="'$(TargetOS)' == 'windows'">$(AssemblyName).exe</RunScriptCommand> <RunScriptCommand Condition="'$(TargetOS)' != 'windows'">chmod +rwx $(AssemblyName) &amp;&amp; ./$(AssemblyName)</RunScriptCommand> </PropertyGroup> <PropertyGroup Condition="'$(TestNativeAot)' != 'true'"> <PublishSingleFile>true</PublishSingleFile> <UseAppHost>true</UseAppHost> <SelfContained>true</SelfContained> <SingleFileHostSourcePath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)', 'corehost'))/singlefilehost</SingleFileHostSourcePath> <SingleFileHostSourcePath Condition="'$(TargetOS)' == 'windows'">$(SingleFileHostSourcePath).exe</SingleFileHostSourcePath> </PropertyGroup> <PropertyGroup Condition="'$(TestNativeAot)' == 'true'"> <IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> <CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">clang-9</CppCompilerAndLinker> <SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> <IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath> <IlcFrameworkPath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkPath> <NoWarn>$(NoWarn);IL3050;IL3051;IL3052;IL3055;IL1005</NoWarn> <TrimmerSingleWarn>false</TrimmerSingleWarn> <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings> <!-- Forced by ILLink targets; we should fix the SDK --> <SelfContained>true</SelfContained> </PropertyGroup> <Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets" Condition="'$(TestNativeAot)' == 'true'" /> <ItemGroup Condition="'$(TestNativeAot)' == 'true'"> <RdXmlFile Include="$(MSBuildThisFileDirectory)default.rd.xml" /> <!-- Tests are doing private reflection. --> <IlcArg Include="--nometadatablocking" /> <!-- xunit calls MakeGenericType to check if something is IEquatable --> <IlcArg Include="--feature:System.Reflection.IsTypeConstructionEagerlyValidated=false" /> </ItemGroup> <ItemGroup> <Compile Include="$(CommonTestPath)SingleFileTestRunner\SingleFileTestRunner.cs" Link="Common\SingleFileTestRunner\SingleFileTestRunner.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="xunit.runner.utility" Version="$(XUnitVersion)" /> </ItemGroup> <Target Name="__ExcludeAssembliesFromSingleFile" Inputs="%(ResolvedFileToPublish.Identity)" Outputs="__NewResolvedFiles" BeforeTargets="_ComputeFilesToBundle"> <PropertyGroup> <__Identity>%(ResolvedFileToPublish.Identity)</__Identity> <__FileName>%(ResolvedFileToPublish.Filename)%(ResolvedFileToPublish.Extension)</__FileName> </PropertyGroup> <ItemGroup> <__NewResolvedFiles Include="@(ResolvedFileToPublish)"> <ExcludeFromSingleFile Condition="'%(__ExcludeFromBundle.Identity)' == '$(__FileName)'">true</ExcludeFromSingleFile> </__NewResolvedFiles> </ItemGroup> </Target> <Target Name="__UpdateExcludedAssembliesFromSingleFile" Inputs="ExcludeFromSingleFile" Outputs="ResolvedFileToPublish" DependsOnTargets="ComputeResolvedFilesToPublishList" BeforeTargets="_ComputeFilesToBundle"> <ItemGroup> <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" /> <ResolvedFileToPublish Include="@(__NewResolvedFiles)" /> </ItemGroup> </Target> <Target Name="PublishTestAsSingleFile" Condition="'$(IsCrossTargetingBuild)' != 'true'" AfterTargets="Build" DependsOnTargets="Publish;ArchiveTests" /> </Project>
<Project> <PropertyGroup> <OutputType>Exe</OutputType> <DefineConstants>$(DefineConstants);SINGLE_FILE_TEST_RUNNER</DefineConstants> <BundleDir>$([MSBuild]::NormalizeDirectory('$(OutDir)', 'publish'))</BundleDir> <RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath> <RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier> <RunScriptCommand Condition="'$(TargetOS)' == 'windows'">$(AssemblyName).exe</RunScriptCommand> <RunScriptCommand Condition="'$(TargetOS)' != 'windows'">chmod +rwx $(AssemblyName) &amp;&amp; ./$(AssemblyName)</RunScriptCommand> </PropertyGroup> <PropertyGroup Condition="'$(TestNativeAot)' != 'true'"> <PublishSingleFile>true</PublishSingleFile> <UseAppHost>true</UseAppHost> <SelfContained>true</SelfContained> </PropertyGroup> <PropertyGroup Condition="'$(TestNativeAot)' == 'true'"> <IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> <CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">clang-9</CppCompilerAndLinker> <SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> <IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath> <IlcFrameworkPath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkPath> <NoWarn>$(NoWarn);IL3050;IL3051;IL3052;IL3055;IL1005</NoWarn> <TrimmerSingleWarn>false</TrimmerSingleWarn> <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings> <!-- Forced by ILLink targets; we should fix the SDK --> <SelfContained>true</SelfContained> </PropertyGroup> <Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets" Condition="'$(TestNativeAot)' == 'true'" /> <ItemGroup Condition="'$(TestNativeAot)' == 'true'"> <RdXmlFile Include="$(MSBuildThisFileDirectory)default.rd.xml" /> <!-- Tests are doing private reflection. --> <IlcArg Include="--nometadatablocking" /> <!-- xunit calls MakeGenericType to check if something is IEquatable --> <IlcArg Include="--feature:System.Reflection.IsTypeConstructionEagerlyValidated=false" /> </ItemGroup> <ItemGroup> <Compile Include="$(CommonTestPath)SingleFileTestRunner\SingleFileTestRunner.cs" Link="Common\SingleFileTestRunner\SingleFileTestRunner.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="xunit.runner.utility" Version="$(XUnitVersion)" /> </ItemGroup> <Target Name="__ExcludeAssembliesFromSingleFile" Inputs="%(ResolvedFileToPublish.Identity)" Outputs="__NewResolvedFiles" BeforeTargets="_ComputeFilesToBundle"> <PropertyGroup> <__Identity>%(ResolvedFileToPublish.Identity)</__Identity> <__FileName>%(ResolvedFileToPublish.Filename)%(ResolvedFileToPublish.Extension)</__FileName> </PropertyGroup> <ItemGroup> <__NewResolvedFiles Include="@(ResolvedFileToPublish)"> <ExcludeFromSingleFile Condition="'%(__ExcludeFromBundle.Identity)' == '$(__FileName)'">true</ExcludeFromSingleFile> </__NewResolvedFiles> </ItemGroup> </Target> <Target Name="__UpdateExcludedAssembliesFromSingleFile" Inputs="ExcludeFromSingleFile" Outputs="ResolvedFileToPublish" DependsOnTargets="ComputeResolvedFilesToPublishList" BeforeTargets="_ComputeFilesToBundle"> <ItemGroup> <ResolvedFileToPublish Remove="@(ResolvedFileToPublish)" /> <ResolvedFileToPublish Include="@(__NewResolvedFiles)" /> </ItemGroup> </Target> <Target Name="PublishTestAsSingleFile" Condition="'$(IsCrossTargetingBuild)' != 'true'" AfterTargets="Build" DependsOnTargets="Publish;ArchiveTests" /> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/UnmanagedPdbSymbolReader.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable enable using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Collections; using System.Diagnostics; using System.Runtime.InteropServices.ComTypes; using System.Runtime.CompilerServices; #if !DISABLE_UNMANAGED_PDB_SYMBOLS using Microsoft.DiaSymReader; #endif using Internal.IL; namespace Internal.TypeSystem.Ecma { #if DISABLE_UNMANAGED_PDB_SYMBOLS /// <summary> /// Provides PdbSymbolReader via unmanaged SymBinder from .NET Framework /// </summary> public abstract class UnmanagedPdbSymbolReader : PdbSymbolReader { public static PdbSymbolReader TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) { return null; } } #else /// <summary> /// Provides PdbSymbolReader via unmanaged SymBinder from .NET Framework /// </summary> public sealed class UnmanagedPdbSymbolReader : PdbSymbolReader { private static int CLRCreateInstance(ref Guid clsid, ref Guid riid, out ClrMetaHostWrapperCache.ClrMetaHostRcw? ppInterface) { int hr = CLRCreateInstance(ref clsid, ref riid, out IntPtr ptr); ppInterface = hr == 0 ? (ClrMetaHostWrapperCache.ClrMetaHostRcw)ClrMetaHostWrapperCache.Instance.GetOrCreateObjectForComInstance(ptr, CreateObjectFlags.UniqueInstance) : null; return hr; [DllImport("mscoree.dll")] static extern int CLRCreateInstance(ref Guid clsid, ref Guid riid, out IntPtr ptr); } interface ICLRMetaHost { public static readonly Guid IID = new Guid("d332db9e-b9b3-4125-8207-a14884f53216"); [PreserveSig] int GetRuntime(string pwzVersion, ref Guid riid, out CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw? ppRuntime); // Don't need any other methods. } private sealed class ClrMetaHostWrapperCache : ComWrappers { public static readonly ClrMetaHostWrapperCache Instance = new ClrMetaHostWrapperCache(); private ClrMetaHostWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); var iid = ICLRMetaHost.IID; if (Marshal.QueryInterface(externalComObject, ref iid, out IntPtr hostPtr) != 0) { throw new ArgumentException("Expected ICLRMetaHost COM interface"); } return new ClrMetaHostRcw(hostPtr); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe class ClrMetaHostRcw : ICLRMetaHost, IDisposable { private bool _disposed; private readonly IntPtr _inst; public ClrMetaHostRcw(IntPtr inst) { _inst = inst; } public int GetRuntime(string pwzVersion, ref Guid riid, out CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw? ppRuntime) { // ICLRMetaHost::GetRuntime() is 4th slot (0-based) var func = (delegate* unmanaged<IntPtr, char*, Guid*, IntPtr*, int>)(*(*(void***)_inst + 3)); int hr; IntPtr runtimeInfoPtr; fixed (char* versionPtr = pwzVersion) fixed (Guid* riidPtr = &riid) { hr = func(_inst, versionPtr, riidPtr, &runtimeInfoPtr); } ppRuntime = hr == 0 ? (CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw)CLRRuntimeInfoWrapperCache.Instance.GetOrCreateObjectForComInstance(runtimeInfoPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public void Dispose() { GC.SuppressFinalize(this); DisposeInternal(); } private void DisposeInternal() { if (_disposed) return; Marshal.Release(_inst); _disposed = true; } ~ClrMetaHostRcw() { DisposeInternal(); } } } interface ICLRRuntimeInfo { int GetInterface(ref Guid rclsid, ref Guid riid, out MetaDataDispenserWrapperCache.MetaDataDispenserRcw? ppUnk); int BindAsLegacyV2Runtime(); // Don't need any other methods. } private class CLRRuntimeInfoWrapperCache : ComWrappers { public static readonly CLRRuntimeInfoWrapperCache Instance = new CLRRuntimeInfoWrapperCache(); private CLRRuntimeInfoWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new ClrRuntimeInfoRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record ClrRuntimeInfoRcw(IntPtr Inst) : ICLRRuntimeInfo, IDisposable { /// <summary> /// List of offsets of methods in the vtable (0-based). First three are from IUnknown. /// </summary> private enum VtableOffset { GetInterface = 9, BindAsLegacyV2Runtime = 13 } private bool _disposed = false; public int GetInterface(ref Guid rclsid, ref Guid riid, out MetaDataDispenserWrapperCache.MetaDataDispenserRcw? ppUnk) { var func = (delegate* unmanaged<IntPtr, Guid*, Guid*, IntPtr*, int>)(*(*(void***)Inst + (int)VtableOffset.GetInterface)); IntPtr outPtr; int hr; fixed (Guid* rclsidPtr = &rclsid) fixed (Guid* riidPtr = &riid) { hr = func(Inst, rclsidPtr, riidPtr, &outPtr); } ppUnk = hr == 0 ? (MetaDataDispenserWrapperCache.MetaDataDispenserRcw)MetaDataDispenserWrapperCache.Instance.GetOrCreateObjectForComInstance(outPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } [PreserveSig] public int BindAsLegacyV2Runtime() { var func = (delegate* unmanaged<IntPtr, int>)(*(*(void***)Inst + (int)VtableOffset.BindAsLegacyV2Runtime)); return func(Inst); } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~ClrRuntimeInfoRcw() { DisposeInternal(); } } } private interface IMetaDataDispenser { int OpenScope(string szScope, int dwOpenFlags, ref Guid riid, out MetadataImportRcw? punk); // Don't need any other methods. } private sealed class MetaDataDispenserWrapperCache : ComWrappers { public static readonly MetaDataDispenserWrapperCache Instance = new MetaDataDispenserWrapperCache(); private MetaDataDispenserWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new MetaDataDispenserRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public sealed unsafe record MetaDataDispenserRcw(IntPtr Inst) : IMetaDataDispenser, IDisposable { private bool _disposed = false; /// <remarks> /// <paramref="punk" /> is simply a boxed IntPtr, because we don't need an RCW. /// </remarks> public int OpenScope(string szScope, int dwOpenFlags, ref Guid riid, out MetadataImportRcw? pUnk) { // IMetaDataDispenserRcw::OpenScope is slot 5 (0-based) var func = (delegate* unmanaged<IntPtr, char*, int, Guid*, IntPtr*, int>)(*(*(void***)Inst + 4)); IntPtr outPtr; int hr; fixed (char* szScopePtr = szScope) fixed (Guid* riidPtr = &riid) { hr = func(Inst, szScopePtr, dwOpenFlags, riidPtr, &outPtr); } pUnk = hr == 0 ? new MetadataImportRcw(outPtr) : null; return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~MetaDataDispenserRcw() { DisposeInternal(); } } } private sealed class CoCreateWrapperCache : ComWrappers { public static readonly CoCreateWrapperCache Instance = new CoCreateWrapperCache(); private CoCreateWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override SymUnmanagedBinderRcw? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); var iid = new Guid("AA544D42-28CB-11d3-BD22-0000F80849BD"); if (Marshal.QueryInterface(externalComObject, ref iid, out IntPtr ppv) != 0) { return null; } return new SymUnmanagedBinderRcw(ppv); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe record SymUnmanagedBinderRcw(IntPtr Inst) : ISymUnmanagedBinder { private bool _disposed = false; public int GetReaderForFile(MetadataImportRcw metadataImporter, string fileName, string searchPath, out SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw? reader) { // ISymUnmanagedBinder::GetReaderForFile is slot 4 (0-based) var func = (delegate* unmanaged<IntPtr, IntPtr, char*, char*, IntPtr*, int>)(*(*(void***)Inst + 3)); int hr; IntPtr readerPtr; fixed (char* fileNamePtr = fileName) fixed (char* searchPathPtr = searchPath) { hr = func(Inst, metadataImporter.Ptr, fileNamePtr, searchPathPtr, &readerPtr); } reader = hr == 0 ? (SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw)SymUnmanagedReaderWrapperCache.Instance.GetOrCreateObjectForComInstance(readerPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetReaderFromStream(object metadataImporter, object stream, out ISymUnmanagedReader reader) => throw new NotImplementedException(); public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedBinderRcw() { DisposeInternal(); } } } /// <summary> /// Wrapper for an IMetaDataImport instance. /// </summary> private sealed record MetadataImportRcw(IntPtr Ptr) : IDisposable { private bool _disposed = false; public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) return; Marshal.Release(Ptr); _disposed = true; } ~MetadataImportRcw() { DisposeInternal(); } } interface ISymUnmanagedReader { int GetMethod(int methodToken, out ISymUnmanagedMethod? method); // No more members are used } private sealed class SymUnmanagedNamespaceWrapperCache : ComWrappers { public static readonly SymUnmanagedNamespaceWrapperCache Instance = new SymUnmanagedNamespaceWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedNamespaceRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedNamespaceRcw(IntPtr Inst) : ISymUnmanagedNamespace { private bool _disposed = false; public int GetName(int bufferLength, out int count, char[] name) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* namePtr = name) { return func(Inst, bufferLength, countPtr, namePtr); } } public int GetNamespaces(int bufferLength, out int count, ISymUnmanagedNamespace[] namespaces) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 4)); int hr; fixed (int* countPtr = &count) { if (namespaces == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[namespaces.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { namespaces[i] = (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetVariables(int bufferLength, out int count, ISymUnmanagedVariable[] variables) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 5)); int hr; fixed (int* countPtr = &count) { if (variables == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[variables.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { variables[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedNamespaceRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedVariableWrapperCache : ComWrappers { public static readonly SymUnmanagedVariableWrapperCache Instance = new SymUnmanagedVariableWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedVariableRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedVariableRcw(IntPtr Inst) : ISymUnmanagedVariable { private bool _disposed = false; public int GetName(int bufferLength, out int count, char[] name) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* namePtr = name) { return func(Inst, bufferLength, countPtr, namePtr); } } public int GetAttributes(out int attributes) => SingleByRefIntWrapper(4, out attributes); public int GetSignature(int bufferLength, out int count, byte[] signature) { var func = (delegate* unmanaged<IntPtr, int, int*, byte*, int>)(*(*(void***)Inst + 5)); fixed (int* countPtr = &count) fixed (byte* signaturePtr = signature) { return func(Inst, bufferLength, countPtr, signaturePtr); } } public int GetAddressKind(out int kind) => SingleByRefIntWrapper(6, out kind); public int GetAddressField1(out int value) => SingleByRefIntWrapper(7, out value); public int GetAddressField2(out int value) => SingleByRefIntWrapper(8, out value); public int GetAddressField3(out int value) => SingleByRefIntWrapper(9, out value); public int GetStartOffset(out int offset) => SingleByRefIntWrapper(10, out offset); public int GetEndOffset(out int offset) => SingleByRefIntWrapper(11, out offset); [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefIntWrapper(int methodSlot, out int value) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + methodSlot)); fixed (int* valuePtr = &value) { return func(Inst, valuePtr); } } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedVariableRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedScopeWrapperCache : ComWrappers { public static readonly SymUnmanagedScopeWrapperCache Instance = new SymUnmanagedScopeWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedScopeRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedScopeRcw(IntPtr Inst) : ISymUnmanagedScope { private bool _disposed = false; public int GetMethod(out ISymUnmanagedMethod? method) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 3)); IntPtr methodPtr; int hr = func(Inst, &methodPtr); method = hr == 0 ? (SymUnmanagedMethodWrapperCache.SymUnmanagedMethodRcw)SymUnmanagedMethodWrapperCache.Instance.GetOrCreateObjectForComInstance(methodPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetParent(out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 4)); IntPtr scopePtr; int hr = func(Inst, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetChildren(int bufferLength, out int count, ISymUnmanagedScope[] children) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 5)); int hr; fixed (int* countPtr = &count) { if (children == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[children.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { children[i] = (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetStartOffset(out int offset) => SingleByRefIntWrapper(6, out offset); public int GetEndOffset(out int offset) => SingleByRefIntWrapper(7, out offset); public int GetLocalCount(out int count) => SingleByRefIntWrapper(8, out count); [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefIntWrapper(int methodSlot, out int value) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + methodSlot)); fixed (int* valuePtr = &value) { return func(Inst, valuePtr); } } public int GetLocals(int bufferLength, out int count, ISymUnmanagedVariable[] locals) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 9)); int hr; fixed (int* countPtr = &count) { if (locals == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[locals.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { locals[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetNamespaces(int bufferLength, out int count, ISymUnmanagedNamespace[] namespaces) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 10)); int hr; fixed (int* countPtr = &count) { if (namespaces == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[namespaces.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { namespaces[i] = (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedScopeRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedDocumentWrapperCache : ComWrappers { public static readonly SymUnmanagedDocumentWrapperCache Instance = new SymUnmanagedDocumentWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedDocumentRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe record SymUnmanagedDocumentRcw(IntPtr Inst) : ISymUnmanagedDocument { private bool _disposed = false; public int GetUrl(int bufferLength, out int count, char[] url) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* urlPtr = url) { return func(Inst, bufferLength, countPtr, urlPtr); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefGuidWrapper(int methodSolt, ref Guid guid) { var func = (delegate* unmanaged<IntPtr, Guid*, int>)(*(*(void***)Inst + methodSolt)); fixed (Guid* guidPtr = &guid) { return func(Inst, guidPtr); } } public int GetDocumentType(ref Guid documentType) => SingleByRefGuidWrapper(4, ref documentType); public int GetLanguage(ref Guid language) => SingleByRefGuidWrapper(5, ref language); public int GetLanguageVendor(ref Guid vendor) => SingleByRefGuidWrapper(6, ref vendor); public int GetChecksumAlgorithmId(ref Guid algorithm) => SingleByRefGuidWrapper(7, ref algorithm); public int GetChecksum(int bufferLength, out int count, byte[] checksum) { var func = (delegate* unmanaged<IntPtr, int, int*, byte*, int>)(*(*(void***)Inst + 8)); fixed (int* countPtr = &count) fixed (byte* checksumPtr = checksum) { return func(Inst, bufferLength, countPtr, checksumPtr); } } public int FindClosestLine(int line, out int closestLine) { var func = (delegate* unmanaged<IntPtr, int, int*, int>)(*(*(void***)Inst + 9)); fixed (int* closestLinePtr = &closestLine) { return func(Inst, line, closestLinePtr); } } public int HasEmbeddedSource(out bool value) { var func = (delegate* unmanaged<IntPtr, bool*, int>)(*(*(void***)Inst + 10)); fixed (bool* valuePtr = &value) { return func(Inst, valuePtr); } } public int GetSourceLength(out int length) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 11)); fixed (int* lengthPtr = &length) { return func(Inst, lengthPtr); } } public int GetSourceRange(int startLine, int startColumn, int endLine, int endColumn, int bufferLength, out int count, byte[] source) { var func = (delegate* unmanaged<IntPtr, int, int, int, int, int, int*, byte*, int>)(*(*(void***)Inst + 12)); fixed (int* countPtr = &count) fixed (byte* sourcePtr = source) { return func(Inst, startLine, startColumn, endLine, endColumn, bufferLength, countPtr, sourcePtr); } } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedDocumentRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedMethodWrapperCache : ComWrappers { public static readonly SymUnmanagedMethodWrapperCache Instance = new SymUnmanagedMethodWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedMethodRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedMethodRcw(IntPtr Inst) : ISymUnmanagedMethod { private bool _disposed = false; public int GetToken(out int methodToken) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 3)); fixed (int* methodTokenPtr = &methodToken) { return func(Inst, methodTokenPtr); } } public int GetSequencePointCount(out int count) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 4)); fixed (int* countPtr = &count) { return func(Inst, countPtr); } } public int GetRootScope(out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 5)); IntPtr scopePtr; int hr = func(Inst, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetScopeFromOffset(int offset, out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, int, IntPtr*, int>)(*(*(void***)Inst + 6)); IntPtr scopePtr; int hr = func(Inst, offset, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetOffset(ISymUnmanagedDocument document, int line, int column, out int offset) { var func = (delegate* unmanaged<IntPtr, IntPtr, int, int, int*, int>)(*(*(void***)Inst + 7)); var handle = GCHandle.Alloc(document, GCHandleType.Pinned); try { fixed (int* offsetPtr = &offset) { return func(Inst, handle.AddrOfPinnedObject(), line, column, offsetPtr); } } finally { handle.Free(); } } public int GetRanges(ISymUnmanagedDocument document, int line, int column, int bufferLength, out int count, int[] ranges) { var func = (delegate* unmanaged<IntPtr, IntPtr, int, int, int, int*, int*, int>)(*(*(void***)Inst + 8)); var handle = GCHandle.Alloc(document, GCHandleType.Pinned); try { fixed (int* countPtr = &count) fixed (int* rangesPtr = ranges) { return func(Inst, handle.AddrOfPinnedObject(), line, column, bufferLength, countPtr, rangesPtr); } } finally { handle.Free(); } } public int GetParameters(int bufferLength, out int count, ISymUnmanagedVariable[] parameters) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 9)); int hr; fixed (int* countPtr = &count) { if (parameters == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[parameters.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { parameters[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetNamespace(out ISymUnmanagedNamespace? @namespace) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 10)); IntPtr namespacePtr; int hr = func(Inst, &namespacePtr); @namespace = hr == 0 ? (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(namespacePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetSourceStartEnd(ISymUnmanagedDocument[] documents, int[] lines, int[] columns, out bool defined) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int*, int*, bool*, int>)(*(*(void***)Inst + 11)); var handle = GCHandle.Alloc(documents, GCHandleType.Pinned); try { fixed (int* linesPtr = lines) fixed (int* columnsPtr = columns) fixed (bool* definedPtr = &defined) { return func(Inst, (IntPtr*)handle.AddrOfPinnedObject(), linesPtr, columnsPtr, definedPtr); } } finally { handle.Free(); } } public int GetSequencePoints(int bufferLength, out int count, int[] offsets, ISymUnmanagedDocument[] documents, int[] startLines, int[] startColumns, int[] endLines, int[] endColumns) { var func = (delegate* unmanaged<IntPtr, int, int*, int*, IntPtr*, int*, int*, int*, int*, int>)(*(*(void***)Inst + 12)); int hr; fixed (int* countPtr = &count) fixed (int* offsetsPtr = offsets) fixed (int* startLinesPtr = startLines) fixed (int* endLinesPtr = endLines) fixed (int* startColumnsPtr = startColumns) fixed (int* endColumnsPtr = endColumns) { if (documents == null) { hr = func(Inst, bufferLength, countPtr, offsetsPtr, null, startLinesPtr, startColumnsPtr, endLinesPtr, endColumnsPtr); } else { IntPtr[] intermediate = new IntPtr[documents.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, offsetsPtr, intermediatePtr, startLinesPtr, startColumnsPtr, endLinesPtr, endColumnsPtr); } if (hr == 0) { for (int i = 0; i < documents.Length; i++) { documents[i] = (SymUnmanagedDocumentWrapperCache.SymUnmanagedDocumentRcw)SymUnmanagedDocumentWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedMethodRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedReaderWrapperCache : ComWrappers { public static readonly SymUnmanagedReaderWrapperCache Instance = new SymUnmanagedReaderWrapperCache(); private SymUnmanagedReaderWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedReaderRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); /// <summary> /// Caveat: implements only the few interface methods currently needed for crossgen2. /// </summary> public sealed record SymUnmanagedReaderRcw(IntPtr Inst) : ISymUnmanagedReader { private bool _disposed = false; public unsafe int GetMethod(int methodToken, out ISymUnmanagedMethod? method) { // ISymUnmanagedReader::GetMethod is slot 7 (0-based) var func = (delegate* unmanaged<IntPtr, int, IntPtr*, int>)(*(*(void***)Inst + 6)); IntPtr methodPtr; int hr = func(Inst, methodToken, &methodPtr); method = hr == 0 ? (SymUnmanagedMethodWrapperCache.SymUnmanagedMethodRcw)SymUnmanagedMethodWrapperCache.Instance.GetOrCreateObjectForComInstance(methodPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedReaderRcw() { DisposeInternal(); } } } private interface ISymUnmanagedBinder { int GetReaderForFile( MetadataImportRcw importer, string filename, string searchPath, out SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw? symReader); } private static int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, out CoCreateWrapperCache.SymUnmanagedBinderRcw? ppv) { Debug.Assert(rclsid == SymBinderIID); int hr = CoCreateInstance(ref rclsid, pUnkOuter, dwClsContext, ref riid, out IntPtr ppvPtr); ppv = hr == 0 ? (CoCreateWrapperCache.SymUnmanagedBinderRcw)CoCreateWrapperCache.Instance.GetOrCreateObjectForComInstance(ppvPtr, CreateObjectFlags.UniqueInstance) : null; return hr; [DllImport("ole32.dll")] static extern int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, out IntPtr ppv); } private void ThrowExceptionForHR(int hr) { Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); } private static readonly Guid SymBinderIID = new Guid(0x0a29ff9e, 0x7f9c, 0x4437, 0x8b, 0x11, 0xf4, 0x24, 0x49, 0x1e, 0x39, 0x31); static UnmanagedPdbSymbolReader() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { try { Guid IID_IUnknown = new Guid(0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); Guid CLSID_CLRMetaHost = new Guid(0x9280188d, 0x0e8e, 0x4867, 0xb3, 0x0c, 0x7f, 0xa8, 0x38, 0x84, 0xe8, 0xde); Guid IID_CLRMetaHost = new Guid(0xd332db9e, 0xb9b3, 0x4125, 0x82, 0x07, 0xa1, 0x48, 0x84, 0xf5, 0x32, 0x16); if (CLRCreateInstance(ref CLSID_CLRMetaHost, ref IID_CLRMetaHost, out var objMetaHost) < 0) return; Debug.Assert(objMetaHost is not null); using (objMetaHost) { Guid IID_CLRRuntimeInfo = new Guid(0xbd39d1d2, 0xba2f, 0x486a, 0x89, 0xb0, 0xb4, 0xb0, 0xcb, 0x46, 0x68, 0x91); if (objMetaHost.GetRuntime("v4.0.30319", ref IID_CLRRuntimeInfo, out var objRuntime) < 0) return; Debug.Assert(objRuntime is not null); using (objRuntime) { // To get everything from the v4 runtime objRuntime.BindAsLegacyV2Runtime(); // Create a COM Metadata dispenser Guid CLSID_CorMetaDataDispenser = new Guid(0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x00, 0x80, 0xc7, 0x92, 0xe5, 0xd8); if (objRuntime.GetInterface(ref CLSID_CorMetaDataDispenser, ref IID_IUnknown, out var objDispenser) < 0) return; Debug.Assert(objDispenser is not null); s_metadataDispenser = objDispenser; // Create a SymBinder Guid CLSID_CorSymBinder = SymBinderIID; if (CoCreateInstance(ref CLSID_CorSymBinder, IntPtr.Zero, // pUnkOuter 1, // CLSCTX_INPROC_SERVER ref IID_IUnknown, out var objBinder) < 0) return; Debug.Assert(objBinder is not null); s_symBinder = objBinder; } } } catch { } } } private readonly static MetaDataDispenserWrapperCache.MetaDataDispenserRcw? s_metadataDispenser; private readonly static CoCreateWrapperCache.SymUnmanagedBinderRcw? s_symBinder; public static PdbSymbolReader? TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) { try { if (s_metadataDispenser == null || s_symBinder == null) return null; Guid IID_IMetaDataImport = new Guid(0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44); // Open an metadata importer on the given filename. We'll end up passing this importer straight // through to the Binder. if (s_metadataDispenser.OpenScope(metadataFileName, 0x00000010 /* read only */, ref IID_IMetaDataImport, out var objImporter) < 0) return null; Debug.Assert(objImporter is not null); using (objImporter) { if (s_symBinder.GetReaderForFile(objImporter, metadataFileName, searchPath, out var reader) < 0) return null; Debug.Assert(reader is not null); return new UnmanagedPdbSymbolReader(reader); } } catch { return null; } } private readonly SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw _symUnmanagedReader; private UnmanagedPdbSymbolReader(SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw symUnmanagedReader) { _symUnmanagedReader = symUnmanagedReader; } public override void Dispose() { _symUnmanagedReader.Dispose(); } private Dictionary<ISymUnmanagedDocument, string>? _urlCache; private string GetUrl(ISymUnmanagedDocument doc) { lock (this) { if (_urlCache == null) _urlCache = new Dictionary<ISymUnmanagedDocument, string>(); if (_urlCache.TryGetValue(doc, out var url)) return url; int urlLength; ThrowExceptionForHR(doc.GetUrl(0, out urlLength, null)); // urlLength includes terminating '\0' char[] urlBuffer = new char[urlLength]; ThrowExceptionForHR(doc.GetUrl(urlLength, out urlLength, urlBuffer)); url = new string(urlBuffer, 0, urlLength - 1); _urlCache.Add(doc, url); return url; } } public override IEnumerable<ILSequencePoint> GetSequencePointsForMethod(int methodToken) { ISymUnmanagedMethod? symbolMethod; if (_symUnmanagedReader.GetMethod(methodToken, out symbolMethod) < 0 || symbolMethod is null) yield break; int count; ThrowExceptionForHR(symbolMethod.GetSequencePointCount(out count)); ISymUnmanagedDocument[] docs = new ISymUnmanagedDocument[count]; int[] lineNumbers = new int[count]; int[] ilOffsets = new int[count]; ThrowExceptionForHR(symbolMethod.GetSequencePoints(count, out count, ilOffsets, docs, lineNumbers, null, null, null)); for (int i = 0; i < count; i++) { if (lineNumbers[i] == 0xFEEFEE) continue; yield return new ILSequencePoint(ilOffsets[i], GetUrl(docs[i]), lineNumbers[i]); } } // // Gather the local details in a scope and then recurse to child scopes // private void ProbeScopeForLocals(List<ILLocalVariable> variables, ISymUnmanagedScope scope) { int localCount; ThrowExceptionForHR(scope.GetLocalCount(out localCount)); ISymUnmanagedVariable[] locals = new ISymUnmanagedVariable[localCount]; ThrowExceptionForHR(scope.GetLocals(localCount, out localCount, locals)); for (int i = 0; i < localCount; i++) { var local = locals[i]; int slot; ThrowExceptionForHR(local.GetAddressField1(out slot)); int nameLength; ThrowExceptionForHR(local.GetName(0, out nameLength, null)); // nameLength includes terminating '\0' char[] nameBuffer = new char[nameLength]; ThrowExceptionForHR(local.GetName(nameLength, out nameLength, nameBuffer)); int attributes; ThrowExceptionForHR(local.GetAttributes(out attributes)); variables.Add(new ILLocalVariable(slot, new String(nameBuffer, 0, nameLength - 1), (attributes & 0x1) != 0)); } int childrenCount; ThrowExceptionForHR(scope.GetChildren(0, out childrenCount, null)); ISymUnmanagedScope[] children = new ISymUnmanagedScope[childrenCount]; ThrowExceptionForHR(scope.GetChildren(childrenCount, out childrenCount, children)); for (int i = 0; i < childrenCount; i++) { ProbeScopeForLocals(variables, children[i]); } } // // Recursively scan the scopes for a method stored in a PDB and gather the local slots // and names for all of them. This assumes a CSC-like compiler that doesn't re-use // local slots in the same method across scopes. // public override IEnumerable<ILLocalVariable>? GetLocalVariableNamesForMethod(int methodToken) { ISymUnmanagedMethod? symbolMethod; if (_symUnmanagedReader.GetMethod(methodToken, out symbolMethod) < 0 || symbolMethod is null) return null; Debug.Assert(symbolMethod is not null); ISymUnmanagedScope rootScope; ThrowExceptionForHR(symbolMethod.GetRootScope(out rootScope)); var variables = new List<ILLocalVariable>(); ProbeScopeForLocals(variables, rootScope); return variables; } public override int GetStateMachineKickoffMethod(int methodToken) { return 0; } } #endif }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable enable using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Collections; using System.Diagnostics; using System.Runtime.InteropServices.ComTypes; using System.Runtime.CompilerServices; #if !DISABLE_UNMANAGED_PDB_SYMBOLS using Microsoft.DiaSymReader; #endif using Internal.IL; namespace Internal.TypeSystem.Ecma { #if DISABLE_UNMANAGED_PDB_SYMBOLS /// <summary> /// Provides PdbSymbolReader via unmanaged SymBinder from .NET Framework /// </summary> public abstract class UnmanagedPdbSymbolReader : PdbSymbolReader { public static PdbSymbolReader? TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) { return null; } } #else /// <summary> /// Provides PdbSymbolReader via unmanaged SymBinder from .NET Framework /// </summary> public sealed class UnmanagedPdbSymbolReader : PdbSymbolReader { private static int CLRCreateInstance(ref Guid clsid, ref Guid riid, out ClrMetaHostWrapperCache.ClrMetaHostRcw? ppInterface) { int hr = CLRCreateInstance(ref clsid, ref riid, out IntPtr ptr); ppInterface = hr == 0 ? (ClrMetaHostWrapperCache.ClrMetaHostRcw)ClrMetaHostWrapperCache.Instance.GetOrCreateObjectForComInstance(ptr, CreateObjectFlags.UniqueInstance) : null; return hr; [DllImport("mscoree.dll")] static extern int CLRCreateInstance(ref Guid clsid, ref Guid riid, out IntPtr ptr); } interface ICLRMetaHost { public static readonly Guid IID = new Guid("d332db9e-b9b3-4125-8207-a14884f53216"); [PreserveSig] int GetRuntime(string pwzVersion, ref Guid riid, out CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw? ppRuntime); // Don't need any other methods. } private sealed class ClrMetaHostWrapperCache : ComWrappers { public static readonly ClrMetaHostWrapperCache Instance = new ClrMetaHostWrapperCache(); private ClrMetaHostWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); var iid = ICLRMetaHost.IID; if (Marshal.QueryInterface(externalComObject, ref iid, out IntPtr hostPtr) != 0) { throw new ArgumentException("Expected ICLRMetaHost COM interface"); } return new ClrMetaHostRcw(hostPtr); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe class ClrMetaHostRcw : ICLRMetaHost, IDisposable { private bool _disposed; private readonly IntPtr _inst; public ClrMetaHostRcw(IntPtr inst) { _inst = inst; } public int GetRuntime(string pwzVersion, ref Guid riid, out CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw? ppRuntime) { // ICLRMetaHost::GetRuntime() is 4th slot (0-based) var func = (delegate* unmanaged<IntPtr, char*, Guid*, IntPtr*, int>)(*(*(void***)_inst + 3)); int hr; IntPtr runtimeInfoPtr; fixed (char* versionPtr = pwzVersion) fixed (Guid* riidPtr = &riid) { hr = func(_inst, versionPtr, riidPtr, &runtimeInfoPtr); } ppRuntime = hr == 0 ? (CLRRuntimeInfoWrapperCache.ClrRuntimeInfoRcw)CLRRuntimeInfoWrapperCache.Instance.GetOrCreateObjectForComInstance(runtimeInfoPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public void Dispose() { GC.SuppressFinalize(this); DisposeInternal(); } private void DisposeInternal() { if (_disposed) return; Marshal.Release(_inst); _disposed = true; } ~ClrMetaHostRcw() { DisposeInternal(); } } } interface ICLRRuntimeInfo { int GetInterface(ref Guid rclsid, ref Guid riid, out MetaDataDispenserWrapperCache.MetaDataDispenserRcw? ppUnk); int BindAsLegacyV2Runtime(); // Don't need any other methods. } private class CLRRuntimeInfoWrapperCache : ComWrappers { public static readonly CLRRuntimeInfoWrapperCache Instance = new CLRRuntimeInfoWrapperCache(); private CLRRuntimeInfoWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new ClrRuntimeInfoRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record ClrRuntimeInfoRcw(IntPtr Inst) : ICLRRuntimeInfo, IDisposable { /// <summary> /// List of offsets of methods in the vtable (0-based). First three are from IUnknown. /// </summary> private enum VtableOffset { GetInterface = 9, BindAsLegacyV2Runtime = 13 } private bool _disposed = false; public int GetInterface(ref Guid rclsid, ref Guid riid, out MetaDataDispenserWrapperCache.MetaDataDispenserRcw? ppUnk) { var func = (delegate* unmanaged<IntPtr, Guid*, Guid*, IntPtr*, int>)(*(*(void***)Inst + (int)VtableOffset.GetInterface)); IntPtr outPtr; int hr; fixed (Guid* rclsidPtr = &rclsid) fixed (Guid* riidPtr = &riid) { hr = func(Inst, rclsidPtr, riidPtr, &outPtr); } ppUnk = hr == 0 ? (MetaDataDispenserWrapperCache.MetaDataDispenserRcw)MetaDataDispenserWrapperCache.Instance.GetOrCreateObjectForComInstance(outPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } [PreserveSig] public int BindAsLegacyV2Runtime() { var func = (delegate* unmanaged<IntPtr, int>)(*(*(void***)Inst + (int)VtableOffset.BindAsLegacyV2Runtime)); return func(Inst); } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~ClrRuntimeInfoRcw() { DisposeInternal(); } } } private interface IMetaDataDispenser { int OpenScope(string szScope, int dwOpenFlags, ref Guid riid, out MetadataImportRcw? punk); // Don't need any other methods. } private sealed class MetaDataDispenserWrapperCache : ComWrappers { public static readonly MetaDataDispenserWrapperCache Instance = new MetaDataDispenserWrapperCache(); private MetaDataDispenserWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new MetaDataDispenserRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public sealed unsafe record MetaDataDispenserRcw(IntPtr Inst) : IMetaDataDispenser, IDisposable { private bool _disposed = false; /// <remarks> /// <paramref="punk" /> is simply a boxed IntPtr, because we don't need an RCW. /// </remarks> public int OpenScope(string szScope, int dwOpenFlags, ref Guid riid, out MetadataImportRcw? pUnk) { // IMetaDataDispenserRcw::OpenScope is slot 5 (0-based) var func = (delegate* unmanaged<IntPtr, char*, int, Guid*, IntPtr*, int>)(*(*(void***)Inst + 4)); IntPtr outPtr; int hr; fixed (char* szScopePtr = szScope) fixed (Guid* riidPtr = &riid) { hr = func(Inst, szScopePtr, dwOpenFlags, riidPtr, &outPtr); } pUnk = hr == 0 ? new MetadataImportRcw(outPtr) : null; return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~MetaDataDispenserRcw() { DisposeInternal(); } } } private sealed class CoCreateWrapperCache : ComWrappers { public static readonly CoCreateWrapperCache Instance = new CoCreateWrapperCache(); private CoCreateWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override SymUnmanagedBinderRcw? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); var iid = new Guid("AA544D42-28CB-11d3-BD22-0000F80849BD"); if (Marshal.QueryInterface(externalComObject, ref iid, out IntPtr ppv) != 0) { return null; } return new SymUnmanagedBinderRcw(ppv); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe record SymUnmanagedBinderRcw(IntPtr Inst) : ISymUnmanagedBinder { private bool _disposed = false; public int GetReaderForFile(MetadataImportRcw metadataImporter, string fileName, string searchPath, out SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw? reader) { // ISymUnmanagedBinder::GetReaderForFile is slot 4 (0-based) var func = (delegate* unmanaged<IntPtr, IntPtr, char*, char*, IntPtr*, int>)(*(*(void***)Inst + 3)); int hr; IntPtr readerPtr; fixed (char* fileNamePtr = fileName) fixed (char* searchPathPtr = searchPath) { hr = func(Inst, metadataImporter.Ptr, fileNamePtr, searchPathPtr, &readerPtr); } reader = hr == 0 ? (SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw)SymUnmanagedReaderWrapperCache.Instance.GetOrCreateObjectForComInstance(readerPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetReaderFromStream(object metadataImporter, object stream, out ISymUnmanagedReader reader) => throw new NotImplementedException(); public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedBinderRcw() { DisposeInternal(); } } } /// <summary> /// Wrapper for an IMetaDataImport instance. /// </summary> private sealed record MetadataImportRcw(IntPtr Ptr) : IDisposable { private bool _disposed = false; public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) return; Marshal.Release(Ptr); _disposed = true; } ~MetadataImportRcw() { DisposeInternal(); } } interface ISymUnmanagedReader { int GetMethod(int methodToken, out ISymUnmanagedMethod? method); // No more members are used } private sealed class SymUnmanagedNamespaceWrapperCache : ComWrappers { public static readonly SymUnmanagedNamespaceWrapperCache Instance = new SymUnmanagedNamespaceWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedNamespaceRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedNamespaceRcw(IntPtr Inst) : ISymUnmanagedNamespace { private bool _disposed = false; public int GetName(int bufferLength, out int count, char[] name) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* namePtr = name) { return func(Inst, bufferLength, countPtr, namePtr); } } public int GetNamespaces(int bufferLength, out int count, ISymUnmanagedNamespace[] namespaces) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 4)); int hr; fixed (int* countPtr = &count) { if (namespaces == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[namespaces.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { namespaces[i] = (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetVariables(int bufferLength, out int count, ISymUnmanagedVariable[] variables) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 5)); int hr; fixed (int* countPtr = &count) { if (variables == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[variables.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { variables[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedNamespaceRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedVariableWrapperCache : ComWrappers { public static readonly SymUnmanagedVariableWrapperCache Instance = new SymUnmanagedVariableWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedVariableRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedVariableRcw(IntPtr Inst) : ISymUnmanagedVariable { private bool _disposed = false; public int GetName(int bufferLength, out int count, char[] name) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* namePtr = name) { return func(Inst, bufferLength, countPtr, namePtr); } } public int GetAttributes(out int attributes) => SingleByRefIntWrapper(4, out attributes); public int GetSignature(int bufferLength, out int count, byte[] signature) { var func = (delegate* unmanaged<IntPtr, int, int*, byte*, int>)(*(*(void***)Inst + 5)); fixed (int* countPtr = &count) fixed (byte* signaturePtr = signature) { return func(Inst, bufferLength, countPtr, signaturePtr); } } public int GetAddressKind(out int kind) => SingleByRefIntWrapper(6, out kind); public int GetAddressField1(out int value) => SingleByRefIntWrapper(7, out value); public int GetAddressField2(out int value) => SingleByRefIntWrapper(8, out value); public int GetAddressField3(out int value) => SingleByRefIntWrapper(9, out value); public int GetStartOffset(out int offset) => SingleByRefIntWrapper(10, out offset); public int GetEndOffset(out int offset) => SingleByRefIntWrapper(11, out offset); [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefIntWrapper(int methodSlot, out int value) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + methodSlot)); fixed (int* valuePtr = &value) { return func(Inst, valuePtr); } } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedVariableRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedScopeWrapperCache : ComWrappers { public static readonly SymUnmanagedScopeWrapperCache Instance = new SymUnmanagedScopeWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedScopeRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedScopeRcw(IntPtr Inst) : ISymUnmanagedScope { private bool _disposed = false; public int GetMethod(out ISymUnmanagedMethod? method) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 3)); IntPtr methodPtr; int hr = func(Inst, &methodPtr); method = hr == 0 ? (SymUnmanagedMethodWrapperCache.SymUnmanagedMethodRcw)SymUnmanagedMethodWrapperCache.Instance.GetOrCreateObjectForComInstance(methodPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetParent(out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 4)); IntPtr scopePtr; int hr = func(Inst, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetChildren(int bufferLength, out int count, ISymUnmanagedScope[] children) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 5)); int hr; fixed (int* countPtr = &count) { if (children == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[children.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { children[i] = (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetStartOffset(out int offset) => SingleByRefIntWrapper(6, out offset); public int GetEndOffset(out int offset) => SingleByRefIntWrapper(7, out offset); public int GetLocalCount(out int count) => SingleByRefIntWrapper(8, out count); [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefIntWrapper(int methodSlot, out int value) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + methodSlot)); fixed (int* valuePtr = &value) { return func(Inst, valuePtr); } } public int GetLocals(int bufferLength, out int count, ISymUnmanagedVariable[] locals) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 9)); int hr; fixed (int* countPtr = &count) { if (locals == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[locals.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { locals[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetNamespaces(int bufferLength, out int count, ISymUnmanagedNamespace[] namespaces) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 10)); int hr; fixed (int* countPtr = &count) { if (namespaces == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[namespaces.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { namespaces[i] = (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedScopeRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedDocumentWrapperCache : ComWrappers { public static readonly SymUnmanagedDocumentWrapperCache Instance = new SymUnmanagedDocumentWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedDocumentRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe record SymUnmanagedDocumentRcw(IntPtr Inst) : ISymUnmanagedDocument { private bool _disposed = false; public int GetUrl(int bufferLength, out int count, char[] url) { var func = (delegate* unmanaged<IntPtr, int, int*, char*, int>)(*(*(void***)Inst + 3)); fixed (int* countPtr = &count) fixed (char* urlPtr = url) { return func(Inst, bufferLength, countPtr, urlPtr); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private int SingleByRefGuidWrapper(int methodSolt, ref Guid guid) { var func = (delegate* unmanaged<IntPtr, Guid*, int>)(*(*(void***)Inst + methodSolt)); fixed (Guid* guidPtr = &guid) { return func(Inst, guidPtr); } } public int GetDocumentType(ref Guid documentType) => SingleByRefGuidWrapper(4, ref documentType); public int GetLanguage(ref Guid language) => SingleByRefGuidWrapper(5, ref language); public int GetLanguageVendor(ref Guid vendor) => SingleByRefGuidWrapper(6, ref vendor); public int GetChecksumAlgorithmId(ref Guid algorithm) => SingleByRefGuidWrapper(7, ref algorithm); public int GetChecksum(int bufferLength, out int count, byte[] checksum) { var func = (delegate* unmanaged<IntPtr, int, int*, byte*, int>)(*(*(void***)Inst + 8)); fixed (int* countPtr = &count) fixed (byte* checksumPtr = checksum) { return func(Inst, bufferLength, countPtr, checksumPtr); } } public int FindClosestLine(int line, out int closestLine) { var func = (delegate* unmanaged<IntPtr, int, int*, int>)(*(*(void***)Inst + 9)); fixed (int* closestLinePtr = &closestLine) { return func(Inst, line, closestLinePtr); } } public int HasEmbeddedSource(out bool value) { var func = (delegate* unmanaged<IntPtr, bool*, int>)(*(*(void***)Inst + 10)); fixed (bool* valuePtr = &value) { return func(Inst, valuePtr); } } public int GetSourceLength(out int length) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 11)); fixed (int* lengthPtr = &length) { return func(Inst, lengthPtr); } } public int GetSourceRange(int startLine, int startColumn, int endLine, int endColumn, int bufferLength, out int count, byte[] source) { var func = (delegate* unmanaged<IntPtr, int, int, int, int, int, int*, byte*, int>)(*(*(void***)Inst + 12)); fixed (int* countPtr = &count) fixed (byte* sourcePtr = source) { return func(Inst, startLine, startColumn, endLine, endColumn, bufferLength, countPtr, sourcePtr); } } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedDocumentRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedMethodWrapperCache : ComWrappers { public static readonly SymUnmanagedMethodWrapperCache Instance = new SymUnmanagedMethodWrapperCache(); protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedMethodRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); public unsafe sealed record SymUnmanagedMethodRcw(IntPtr Inst) : ISymUnmanagedMethod { private bool _disposed = false; public int GetToken(out int methodToken) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 3)); fixed (int* methodTokenPtr = &methodToken) { return func(Inst, methodTokenPtr); } } public int GetSequencePointCount(out int count) { var func = (delegate* unmanaged<IntPtr, int*, int>)(*(*(void***)Inst + 4)); fixed (int* countPtr = &count) { return func(Inst, countPtr); } } public int GetRootScope(out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 5)); IntPtr scopePtr; int hr = func(Inst, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetScopeFromOffset(int offset, out ISymUnmanagedScope? scope) { var func = (delegate* unmanaged<IntPtr, int, IntPtr*, int>)(*(*(void***)Inst + 6)); IntPtr scopePtr; int hr = func(Inst, offset, &scopePtr); scope = hr == 0 ? (SymUnmanagedScopeWrapperCache.SymUnmanagedScopeRcw)SymUnmanagedScopeWrapperCache.Instance.GetOrCreateObjectForComInstance(scopePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetOffset(ISymUnmanagedDocument document, int line, int column, out int offset) { var func = (delegate* unmanaged<IntPtr, IntPtr, int, int, int*, int>)(*(*(void***)Inst + 7)); var handle = GCHandle.Alloc(document, GCHandleType.Pinned); try { fixed (int* offsetPtr = &offset) { return func(Inst, handle.AddrOfPinnedObject(), line, column, offsetPtr); } } finally { handle.Free(); } } public int GetRanges(ISymUnmanagedDocument document, int line, int column, int bufferLength, out int count, int[] ranges) { var func = (delegate* unmanaged<IntPtr, IntPtr, int, int, int, int*, int*, int>)(*(*(void***)Inst + 8)); var handle = GCHandle.Alloc(document, GCHandleType.Pinned); try { fixed (int* countPtr = &count) fixed (int* rangesPtr = ranges) { return func(Inst, handle.AddrOfPinnedObject(), line, column, bufferLength, countPtr, rangesPtr); } } finally { handle.Free(); } } public int GetParameters(int bufferLength, out int count, ISymUnmanagedVariable[] parameters) { var func = (delegate* unmanaged<IntPtr, int, int*, IntPtr*, int>)(*(*(void***)Inst + 9)); int hr; fixed (int* countPtr = &count) { if (parameters == null) { hr = func(Inst, bufferLength, countPtr, null); } else { IntPtr[] intermediate = new IntPtr[parameters.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, intermediatePtr); } if (hr == 0) { for (int i = 0; i < count; i++) { parameters[i] = (SymUnmanagedVariableWrapperCache.SymUnmanagedVariableRcw)SymUnmanagedVariableWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public int GetNamespace(out ISymUnmanagedNamespace? @namespace) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)Inst + 10)); IntPtr namespacePtr; int hr = func(Inst, &namespacePtr); @namespace = hr == 0 ? (SymUnmanagedNamespaceWrapperCache.SymUnmanagedNamespaceRcw)SymUnmanagedNamespaceWrapperCache.Instance.GetOrCreateObjectForComInstance(namespacePtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public int GetSourceStartEnd(ISymUnmanagedDocument[] documents, int[] lines, int[] columns, out bool defined) { var func = (delegate* unmanaged<IntPtr, IntPtr*, int*, int*, bool*, int>)(*(*(void***)Inst + 11)); var handle = GCHandle.Alloc(documents, GCHandleType.Pinned); try { fixed (int* linesPtr = lines) fixed (int* columnsPtr = columns) fixed (bool* definedPtr = &defined) { return func(Inst, (IntPtr*)handle.AddrOfPinnedObject(), linesPtr, columnsPtr, definedPtr); } } finally { handle.Free(); } } public int GetSequencePoints(int bufferLength, out int count, int[] offsets, ISymUnmanagedDocument[] documents, int[] startLines, int[] startColumns, int[] endLines, int[] endColumns) { var func = (delegate* unmanaged<IntPtr, int, int*, int*, IntPtr*, int*, int*, int*, int*, int>)(*(*(void***)Inst + 12)); int hr; fixed (int* countPtr = &count) fixed (int* offsetsPtr = offsets) fixed (int* startLinesPtr = startLines) fixed (int* endLinesPtr = endLines) fixed (int* startColumnsPtr = startColumns) fixed (int* endColumnsPtr = endColumns) { if (documents == null) { hr = func(Inst, bufferLength, countPtr, offsetsPtr, null, startLinesPtr, startColumnsPtr, endLinesPtr, endColumnsPtr); } else { IntPtr[] intermediate = new IntPtr[documents.Length]; fixed (IntPtr* intermediatePtr = intermediate) { hr = func(Inst, bufferLength, countPtr, offsetsPtr, intermediatePtr, startLinesPtr, startColumnsPtr, endLinesPtr, endColumnsPtr); } if (hr == 0) { for (int i = 0; i < documents.Length; i++) { documents[i] = (SymUnmanagedDocumentWrapperCache.SymUnmanagedDocumentRcw)SymUnmanagedDocumentWrapperCache.Instance.GetOrCreateObjectForComInstance(intermediate[i], CreateObjectFlags.UniqueInstance); } } } } return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedMethodRcw() { DisposeInternal(); } } } private sealed class SymUnmanagedReaderWrapperCache : ComWrappers { public static readonly SymUnmanagedReaderWrapperCache Instance = new SymUnmanagedReaderWrapperCache(); private SymUnmanagedReaderWrapperCache() { } protected override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) => throw new NotImplementedException(); protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { Debug.Assert(flags == CreateObjectFlags.UniqueInstance); return new SymUnmanagedReaderRcw(externalComObject); } protected override void ReleaseObjects(IEnumerable objects) => throw new NotImplementedException(); /// <summary> /// Caveat: implements only the few interface methods currently needed for crossgen2. /// </summary> public sealed record SymUnmanagedReaderRcw(IntPtr Inst) : ISymUnmanagedReader { private bool _disposed = false; public unsafe int GetMethod(int methodToken, out ISymUnmanagedMethod? method) { // ISymUnmanagedReader::GetMethod is slot 7 (0-based) var func = (delegate* unmanaged<IntPtr, int, IntPtr*, int>)(*(*(void***)Inst + 6)); IntPtr methodPtr; int hr = func(Inst, methodToken, &methodPtr); method = hr == 0 ? (SymUnmanagedMethodWrapperCache.SymUnmanagedMethodRcw)SymUnmanagedMethodWrapperCache.Instance.GetOrCreateObjectForComInstance(methodPtr, CreateObjectFlags.UniqueInstance) : null; return hr; } public void Dispose() { DisposeInternal(); GC.SuppressFinalize(this); } private void DisposeInternal() { if (_disposed) { return; } _disposed = true; Marshal.Release(Inst); } ~SymUnmanagedReaderRcw() { DisposeInternal(); } } } private interface ISymUnmanagedBinder { int GetReaderForFile( MetadataImportRcw importer, string filename, string searchPath, out SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw? symReader); } private static int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, out CoCreateWrapperCache.SymUnmanagedBinderRcw? ppv) { Debug.Assert(rclsid == SymBinderIID); int hr = CoCreateInstance(ref rclsid, pUnkOuter, dwClsContext, ref riid, out IntPtr ppvPtr); ppv = hr == 0 ? (CoCreateWrapperCache.SymUnmanagedBinderRcw)CoCreateWrapperCache.Instance.GetOrCreateObjectForComInstance(ppvPtr, CreateObjectFlags.UniqueInstance) : null; return hr; [DllImport("ole32.dll")] static extern int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, out IntPtr ppv); } private void ThrowExceptionForHR(int hr) { Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); } private static readonly Guid SymBinderIID = new Guid(0x0a29ff9e, 0x7f9c, 0x4437, 0x8b, 0x11, 0xf4, 0x24, 0x49, 0x1e, 0x39, 0x31); static UnmanagedPdbSymbolReader() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { try { Guid IID_IUnknown = new Guid(0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); Guid CLSID_CLRMetaHost = new Guid(0x9280188d, 0x0e8e, 0x4867, 0xb3, 0x0c, 0x7f, 0xa8, 0x38, 0x84, 0xe8, 0xde); Guid IID_CLRMetaHost = new Guid(0xd332db9e, 0xb9b3, 0x4125, 0x82, 0x07, 0xa1, 0x48, 0x84, 0xf5, 0x32, 0x16); if (CLRCreateInstance(ref CLSID_CLRMetaHost, ref IID_CLRMetaHost, out var objMetaHost) < 0) return; Debug.Assert(objMetaHost is not null); using (objMetaHost) { Guid IID_CLRRuntimeInfo = new Guid(0xbd39d1d2, 0xba2f, 0x486a, 0x89, 0xb0, 0xb4, 0xb0, 0xcb, 0x46, 0x68, 0x91); if (objMetaHost.GetRuntime("v4.0.30319", ref IID_CLRRuntimeInfo, out var objRuntime) < 0) return; Debug.Assert(objRuntime is not null); using (objRuntime) { // To get everything from the v4 runtime objRuntime.BindAsLegacyV2Runtime(); // Create a COM Metadata dispenser Guid CLSID_CorMetaDataDispenser = new Guid(0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x00, 0x80, 0xc7, 0x92, 0xe5, 0xd8); if (objRuntime.GetInterface(ref CLSID_CorMetaDataDispenser, ref IID_IUnknown, out var objDispenser) < 0) return; Debug.Assert(objDispenser is not null); s_metadataDispenser = objDispenser; // Create a SymBinder Guid CLSID_CorSymBinder = SymBinderIID; if (CoCreateInstance(ref CLSID_CorSymBinder, IntPtr.Zero, // pUnkOuter 1, // CLSCTX_INPROC_SERVER ref IID_IUnknown, out var objBinder) < 0) return; Debug.Assert(objBinder is not null); s_symBinder = objBinder; } } } catch { } } } private readonly static MetaDataDispenserWrapperCache.MetaDataDispenserRcw? s_metadataDispenser; private readonly static CoCreateWrapperCache.SymUnmanagedBinderRcw? s_symBinder; public static PdbSymbolReader? TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) { try { if (s_metadataDispenser == null || s_symBinder == null) return null; Guid IID_IMetaDataImport = new Guid(0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44); // Open an metadata importer on the given filename. We'll end up passing this importer straight // through to the Binder. if (s_metadataDispenser.OpenScope(metadataFileName, 0x00000010 /* read only */, ref IID_IMetaDataImport, out var objImporter) < 0) return null; Debug.Assert(objImporter is not null); using (objImporter) { if (s_symBinder.GetReaderForFile(objImporter, metadataFileName, searchPath, out var reader) < 0) return null; Debug.Assert(reader is not null); return new UnmanagedPdbSymbolReader(reader); } } catch { return null; } } private readonly SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw _symUnmanagedReader; private UnmanagedPdbSymbolReader(SymUnmanagedReaderWrapperCache.SymUnmanagedReaderRcw symUnmanagedReader) { _symUnmanagedReader = symUnmanagedReader; } public override void Dispose() { _symUnmanagedReader.Dispose(); } private Dictionary<ISymUnmanagedDocument, string>? _urlCache; private string GetUrl(ISymUnmanagedDocument doc) { lock (this) { if (_urlCache == null) _urlCache = new Dictionary<ISymUnmanagedDocument, string>(); if (_urlCache.TryGetValue(doc, out var url)) return url; int urlLength; ThrowExceptionForHR(doc.GetUrl(0, out urlLength, null)); // urlLength includes terminating '\0' char[] urlBuffer = new char[urlLength]; ThrowExceptionForHR(doc.GetUrl(urlLength, out urlLength, urlBuffer)); url = new string(urlBuffer, 0, urlLength - 1); _urlCache.Add(doc, url); return url; } } public override IEnumerable<ILSequencePoint> GetSequencePointsForMethod(int methodToken) { ISymUnmanagedMethod? symbolMethod; if (_symUnmanagedReader.GetMethod(methodToken, out symbolMethod) < 0 || symbolMethod is null) yield break; int count; ThrowExceptionForHR(symbolMethod.GetSequencePointCount(out count)); ISymUnmanagedDocument[] docs = new ISymUnmanagedDocument[count]; int[] lineNumbers = new int[count]; int[] ilOffsets = new int[count]; ThrowExceptionForHR(symbolMethod.GetSequencePoints(count, out count, ilOffsets, docs, lineNumbers, null, null, null)); for (int i = 0; i < count; i++) { if (lineNumbers[i] == 0xFEEFEE) continue; yield return new ILSequencePoint(ilOffsets[i], GetUrl(docs[i]), lineNumbers[i]); } } // // Gather the local details in a scope and then recurse to child scopes // private void ProbeScopeForLocals(List<ILLocalVariable> variables, ISymUnmanagedScope scope) { int localCount; ThrowExceptionForHR(scope.GetLocalCount(out localCount)); ISymUnmanagedVariable[] locals = new ISymUnmanagedVariable[localCount]; ThrowExceptionForHR(scope.GetLocals(localCount, out localCount, locals)); for (int i = 0; i < localCount; i++) { var local = locals[i]; int slot; ThrowExceptionForHR(local.GetAddressField1(out slot)); int nameLength; ThrowExceptionForHR(local.GetName(0, out nameLength, null)); // nameLength includes terminating '\0' char[] nameBuffer = new char[nameLength]; ThrowExceptionForHR(local.GetName(nameLength, out nameLength, nameBuffer)); int attributes; ThrowExceptionForHR(local.GetAttributes(out attributes)); variables.Add(new ILLocalVariable(slot, new String(nameBuffer, 0, nameLength - 1), (attributes & 0x1) != 0)); } int childrenCount; ThrowExceptionForHR(scope.GetChildren(0, out childrenCount, null)); ISymUnmanagedScope[] children = new ISymUnmanagedScope[childrenCount]; ThrowExceptionForHR(scope.GetChildren(childrenCount, out childrenCount, children)); for (int i = 0; i < childrenCount; i++) { ProbeScopeForLocals(variables, children[i]); } } // // Recursively scan the scopes for a method stored in a PDB and gather the local slots // and names for all of them. This assumes a CSC-like compiler that doesn't re-use // local slots in the same method across scopes. // public override IEnumerable<ILLocalVariable>? GetLocalVariableNamesForMethod(int methodToken) { ISymUnmanagedMethod? symbolMethod; if (_symUnmanagedReader.GetMethod(methodToken, out symbolMethod) < 0 || symbolMethod is null) return null; Debug.Assert(symbolMethod is not null); ISymUnmanagedScope rootScope; ThrowExceptionForHR(symbolMethod.GetRootScope(out rootScope)); var variables = new List<ILLocalVariable>(); ProbeScopeForLocals(variables, rootScope); return variables; } public override int GetStateMachineKickoffMethod(int methodToken) { return 0; } } #endif }
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/aot/ILCompiler/ILCompiler.props
<Project> <PropertyGroup> <AssemblyName>ilc</AssemblyName> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <NoWarn>8002,NU1701</NoWarn> <Platforms>x64;x86</Platforms> <PlatformTarget>AnyCPU</PlatformTarget> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems> <Configurations>Debug;Release;Checked</Configurations> <ServerGarbageCollection>true</ServerGarbageCollection> <TieredCompilation>false</TieredCompilation> </PropertyGroup> <PropertyGroup> <SelfContained>true</SelfContained> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <UseAppHost>true</UseAppHost> </PropertyGroup> <PropertyGroup> <!-- Massage the RuntimeIdentifier into an ObjWriter package RID that we can download --> <_objWriterRidPlatformIndex>$(RuntimeIdentifier.LastIndexOf('-'))</_objWriterRidPlatformIndex> <ObjWriterRidWithoutPlatform>$(RuntimeIdentifier.Substring(0, $(_objWriterRidPlatformIndex)))</ObjWriterRidWithoutPlatform> <ObjWriterRidPlatform>$(RuntimeIdentifier.Substring($(_objWriterRidPlatformIndex)).TrimStart('-'))</ObjWriterRidPlatform> <!-- If it's not win/osx/linux-musl, it's a non-portable Linux. Treat as Linux. --> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' != 'win' and '$(ObjWriterRidWithoutPlatform)' != 'osx' and '$(ObjWriterRidWithoutPlatform)' != 'linux-musl'">linux</ObjWriterRidWithoutPlatform> <!-- OSX builds have a version --> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' == 'osx' and '$(ObjWriterRidPlatform)' == 'x64'">osx.10.12</ObjWriterRidWithoutPlatform> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' == 'osx' and '$(ObjWriterRidPlatform)' == 'arm64'">osx.11.0</ObjWriterRidWithoutPlatform> <ObjWriterRid Condition="'$(ObjWriterRid)' == ''">$(ObjWriterRidWithoutPlatform)-$(ObjWriterRidPlatform)</ObjWriterRid> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-arm64'">$(runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-x64'">$(runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-musl-arm64'">$(runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-musl-x64'">$(runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'win-arm64'">$(runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'win-x64'">$(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'osx.11.0-arm64'">$(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'osx.10.12-x64'">$(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <!-- CoreDisTools are used in debugging visualizers. --> <IncludeCoreDisTools Condition="'$(Configuration)' != 'Release' and '$(CrossHostArch)' == ''">true</IncludeCoreDisTools> </PropertyGroup> <Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(IncludeCoreDisTools)' == 'true'" /> <ItemGroup> <PackageReference Include="runtime.$(ObjWriterRid).Microsoft.NETCore.Runtime.ObjWriter"> <Version>$(ObjWriterVersion)</Version> </PackageReference> <Content Include="$(NuGetPackageRoot)runtime.$(ObjWriterRid).microsoft.netcore.runtime.objwriter\$(ObjWriterVersion)\runtimes\$(ObjWriterRid)\native\$(LibPrefix)objwriter$(LibSuffix)"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Visible>false</Visible> <Pack>false</Pack> </Content> <Content Include="$(CoreDisToolsLibrary)" Condition="Exists('$(CoreDisToolsLibrary)') and '$(IncludeCoreDisTools)' == 'true'"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> <ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" /> <ProjectReference Include="..\ILCompiler.MetadataTransform\ILCompiler.MetadataTransform.csproj" /> <ProjectReference Include="..\ILCompiler.RyuJit\ILCompiler.RyuJit.csproj" /> <ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" /> <ProjectReference Include="..\ILCompiler.Compiler\ILCompiler.Compiler.csproj" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Common\CommandLine\Argument.cs" /> <Compile Include="..\..\Common\CommandLine\Argument_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentLexer.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentList_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentParser.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax_Definers.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntaxException.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentToken.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineException.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineHelpers.cs" /> <Compile Include="..\..\Common\CommandLine\Enumerable.cs" /> <Compile Include="..\..\Common\CommandLine\HelpTextGenerator.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="..\..\Common\CommandLine\Resources\Strings.resx"> <GenerateSource>true</GenerateSource> <ClassName>Internal.CommandLine.Strings</ClassName> </EmbeddedResource> </ItemGroup> <ItemGroup> <Compile Remove="repro\*" /> </ItemGroup> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'osx' and '$(TargetArchitecture)' == 'arm64'">unix_osx</TargetOSComponent> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' == ''">$(TargetArchitecture)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' != ''">$(CrossHostArch)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(TargetArchitectureForSharedLibraries)'=='armel'">arm</TargetArchitectureForSharedLibraries> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitectureForLocalJitBuild)' == ''">$(TargetArchitecture)</TargetArchitectureForLocalJitBuild> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitecture)'=='armel'">arm</TargetArchitectureForLocalJitBuild> <TargetSpec>$(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries)</TargetSpec> <JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName> </PropertyGroup> <ItemGroup> <Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(JitInterfaceLibraryName)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> <Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> </Project>
<Project> <PropertyGroup> <AssemblyName>ilc</AssemblyName> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <NoWarn>8002,NU1701</NoWarn> <Platforms>x64;x86</Platforms> <PlatformTarget>AnyCPU</PlatformTarget> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems> <Configurations>Debug;Release;Checked</Configurations> <ServerGarbageCollection>true</ServerGarbageCollection> <TieredCompilation>false</TieredCompilation> </PropertyGroup> <PropertyGroup> <SelfContained>true</SelfContained> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <UseAppHost>true</UseAppHost> </PropertyGroup> <PropertyGroup> <!-- Massage the RuntimeIdentifier into an ObjWriter package RID that we can download --> <_objWriterRidPlatformIndex>$(RuntimeIdentifier.LastIndexOf('-'))</_objWriterRidPlatformIndex> <ObjWriterRidWithoutPlatform>$(RuntimeIdentifier.Substring(0, $(_objWriterRidPlatformIndex)))</ObjWriterRidWithoutPlatform> <ObjWriterRidPlatform>$(RuntimeIdentifier.Substring($(_objWriterRidPlatformIndex)).TrimStart('-'))</ObjWriterRidPlatform> <!-- If it's not win/osx/linux-musl, it's a non-portable Linux. Treat as Linux. --> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' != 'win' and '$(ObjWriterRidWithoutPlatform)' != 'osx' and '$(ObjWriterRidWithoutPlatform)' != 'linux-musl'">linux</ObjWriterRidWithoutPlatform> <!-- OSX builds have a version --> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' == 'osx' and '$(ObjWriterRidPlatform)' == 'x64'">osx.10.12</ObjWriterRidWithoutPlatform> <ObjWriterRidWithoutPlatform Condition="'$(ObjWriterRidWithoutPlatform)' == 'osx' and '$(ObjWriterRidPlatform)' == 'arm64'">osx.11.0</ObjWriterRidWithoutPlatform> <ObjWriterRid Condition="'$(ObjWriterRid)' == ''">$(ObjWriterRidWithoutPlatform)-$(ObjWriterRidPlatform)</ObjWriterRid> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-arm64'">$(runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-x64'">$(runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-musl-arm64'">$(runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'linux-musl-x64'">$(runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'win-arm64'">$(runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'win-x64'">$(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'osx.11.0-arm64'">$(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <ObjWriterVersion Condition="'$(ObjWriterVersion)' == '' and '$(ObjWriterRid)' == 'osx.10.12-x64'">$(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion)</ObjWriterVersion> <!-- CoreDisTools are used in debugging visualizers. --> <IncludeCoreDisTools Condition="'$(Configuration)' != 'Release' and '$(CrossHostArch)' == ''">true</IncludeCoreDisTools> </PropertyGroup> <Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="'$(DotNetBuildFromSource)' != 'true' and '$(IncludeCoreDisTools)' == 'true'" /> <ItemGroup> <PackageReference Include="runtime.$(ObjWriterRid).Microsoft.NETCore.Runtime.ObjWriter"> <Version>$(ObjWriterVersion)</Version> </PackageReference> <Content Include="$(NuGetPackageRoot)runtime.$(ObjWriterRid).microsoft.netcore.runtime.objwriter\$(ObjWriterVersion)\runtimes\$(ObjWriterRid)\native\$(LibPrefix)objwriter$(LibSuffix)"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <Visible>false</Visible> <Pack>false</Pack> </Content> <Content Include="$(CoreDisToolsLibrary)" Condition="Exists('$(CoreDisToolsLibrary)') and '$(IncludeCoreDisTools)' == 'true'"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> <ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" /> <ProjectReference Include="..\ILCompiler.MetadataTransform\ILCompiler.MetadataTransform.csproj" /> <ProjectReference Include="..\ILCompiler.RyuJit\ILCompiler.RyuJit.csproj" /> <ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" /> <ProjectReference Include="..\ILCompiler.Compiler\ILCompiler.Compiler.csproj" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Common\CommandLine\Argument.cs" /> <Compile Include="..\..\Common\CommandLine\Argument_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentLexer.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentList_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentParser.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax_Definers.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntaxException.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentToken.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineException.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineHelpers.cs" /> <Compile Include="..\..\Common\CommandLine\Enumerable.cs" /> <Compile Include="..\..\Common\CommandLine\HelpTextGenerator.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="..\..\Common\CommandLine\Resources\Strings.resx"> <GenerateSource>true</GenerateSource> <ClassName>Internal.CommandLine.Strings</ClassName> </EmbeddedResource> </ItemGroup> <ItemGroup> <Compile Remove="repro\*" /> </ItemGroup> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'osx' and '$(TargetArchitecture)' == 'arm64'">unix_osx</TargetOSComponent> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' == ''">$(TargetArchitecture)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' != ''">$(CrossHostArch)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(TargetArchitectureForSharedLibraries)'=='armel'">arm</TargetArchitectureForSharedLibraries> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitectureForLocalJitBuild)' == ''">$(TargetArchitecture)</TargetArchitectureForLocalJitBuild> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitecture)'=='armel'">arm</TargetArchitectureForLocalJitBuild> <TargetSpec>$(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries)</TargetSpec> <JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName> <!-- This will be provided when using the liveBuild, and unset otherwise. --> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == ''">$(RuntimeBinDir)$(CrossHostArch)</CoreCLRArtifactsPath> </PropertyGroup> <ItemGroup> <Content Include="$(CoreCLRArtifactsPath)/$(JitInterfaceLibraryName)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> <Content Include="$(CoreCLRArtifactsPath)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/aot/crossgen2/crossgen2.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputPath>$(RuntimeBinDir)/crossgen2</OutputPath> <!-- The default value for macOS is false --> <UseAppHost>true</UseAppHost> <AppHostRuntimeIdentifier>$(Crossgen2PackageRID)</AppHostRuntimeIdentifier> </PropertyGroup> <Import Project="crossgen2.props" /> </Project>
<Project> <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <PropertyGroup> <OutputPath>$(RuntimeBinDir)crossgen2</OutputPath> <!-- Can't use NativeAOT in source build yet https://github.com/dotnet/runtime/issues/66859 and we don't want to ship using NativeAOT on MacOS --> <NativeAotSupported Condition="'$(DotNetBuildFromSource)' == 'true' or '$(TargetOS)' == 'osx'">false</NativeAotSupported> <!-- Trimming is not currently working, but set the appropriate feature flags for NativeAOT --> <PublishTrimmed Condition="'$(NativeAotSupported)' == 'true'">true</PublishTrimmed> <RuntimeIdentifiers Condition="'$(RunningPublish)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers> </PropertyGroup> <Import Project="crossgen2.props" /> <PropertyGroup Condition="'$(NativeAotSupported)' != 'true'"> <PublishSingleFile>true</PublishSingleFile> <PublishReadyToRun>true</PublishReadyToRun> <!-- Disable crossgen on NetBSD, illumos and Solaris for now. This can be revisited when we have full support. --> <PublishReadyToRun Condition="'$(TargetOS)'=='NetBSD' Or '$(TargetOS)'=='illumos' Or '$(TargetOS)'=='Solaris'">false</PublishReadyToRun> <!-- Disable crossgen on FreeBSD when cross building from Linux. --> <PublishReadyToRun Condition="'$(TargetOS)'=='FreeBSD' and '$(CrossBuild)'=='true'">false</PublishReadyToRun> <PublishReadyToRunComposite>true</PublishReadyToRunComposite> </PropertyGroup> <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> <PropertyGroup Condition="'$(NativeAotSupported)' == 'true'"> <IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> <CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">clang-9</CppCompilerAndLinker> <SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> <IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath> <IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</IlcFrameworkPath> <IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath> <TrimmerSingleWarn>false</TrimmerSingleWarn> <!-- Forced by ILLink targets; we should fix the SDK --> <SelfContained Condition="'$(RunningPublish)' == 'true'">true</SelfContained> </PropertyGroup> <Import Project="$(R2ROverridePath)" Condition="'$(R2ROverridePath)' != ''" /> <Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets" Condition="'$(NativeAotSupported)' == 'true' and '$(RunningPublish)' == 'true'" /> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/aot/crossgen2/crossgen2.props
<Project> <PropertyGroup> <AssemblyName>crossgen2</AssemblyName> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <NoWarn>8002,NU1701</NoWarn> <Platforms>x64;x86;arm64;arm</Platforms> <PlatformTarget>AnyCPU</PlatformTarget> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems> <Configurations>Debug;Release;Checked</Configurations> <ServerGarbageCollection>true</ServerGarbageCollection> <!-- Trim all dependent assemblies as though they were all marked IsTrimmable. --> <TrimmerDefaultAction>link</TrimmerDefaultAction> </PropertyGroup> <ItemGroup Label="Embedded Resources"> <EmbeddedResource Include="Properties\Resources.resx"> <GenerateSource>true</GenerateSource> <ClassName>System.SR</ClassName> </EmbeddedResource> <EmbeddedResource Include="..\..\Common\CommandLine\Resources\Strings.resx"> <GenerateSource>true</GenerateSource> <ClassName>Internal.CommandLine.Strings</ClassName> </EmbeddedResource> </ItemGroup> <ItemGroup> <ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" /> <ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" /> <ProjectReference Include="..\ILCompiler.ReadyToRun\ILCompiler.ReadyToRun.csproj" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Common\CommandLine\Argument.cs" /> <Compile Include="..\..\Common\CommandLine\Argument_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentLexer.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentList_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentParser.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax_Definers.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntaxException.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentToken.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineException.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineHelpers.cs" /> <Compile Include="..\..\Common\CommandLine\Enumerable.cs" /> <Compile Include="..\..\Common\CommandLine\HelpTextGenerator.cs" /> </ItemGroup> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'osx' and '$(TargetArchitecture)' == 'arm64'">unix_osx</TargetOSComponent> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' == ''">$(TargetArchitecture)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' != ''">$(CrossHostArch)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(TargetArchitectureForSharedLibraries)'=='armel'">arm</TargetArchitectureForSharedLibraries> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitectureForLocalJitBuild)' == ''">$(TargetArchitecture)</TargetArchitectureForLocalJitBuild> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitecture)'=='armel'">arm</TargetArchitectureForLocalJitBuild> <TargetSpec>$(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries)</TargetSpec> <JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName> </PropertyGroup> <ItemGroup> <Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(JitInterfaceLibraryName)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> <Content Include="$(RuntimeBinDir)$(CrossHostArch)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> <ItemGroup Condition="'$(TargetOS)' == 'windows'"> <Content Include="$(RuntimeBinDir)/pgort*.dll" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" Condition="'$(PgoInstrument)' != ''" /> <PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativeVersion)" IsImplicitlyDefined="true" ExcludeAssets="all" GeneratePathProperty="true" /> </ItemGroup> <PropertyGroup Condition="'$(TargetOS)' == 'windows'"> <DiaSymReaderTargetArch>$(TargetArchitectureForSharedLibraries)</DiaSymReaderTargetArch> <DiaSymReaderTargetArch Condition="'$(DiaSymReaderTargetArch)' == 'x64'">amd64</DiaSymReaderTargetArch> <DiaSymReaderTargetArchFileName>Microsoft.DiaSymReader.Native.$(DiaSymReaderTargetArch).dll</DiaSymReaderTargetArchFileName> <DiaSymReaderTargetArchPath>$(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> </PropertyGroup> <ItemGroup Condition="'$(TargetOS)' == 'windows'"> <Content Include="$(DiaSymReaderTargetArchPath)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> </Project>
<Project> <PropertyGroup> <AssemblyName>crossgen2</AssemblyName> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <NoWarn>8002,NU1701</NoWarn> <Platforms>x64;x86;arm64;arm</Platforms> <PlatformTarget>AnyCPU</PlatformTarget> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems> <Configurations>Debug;Release;Checked</Configurations> <ServerGarbageCollection>true</ServerGarbageCollection> <!-- Trim all dependent assemblies as though they were all marked IsTrimmable. --> <TrimmerDefaultAction>link</TrimmerDefaultAction> </PropertyGroup> <ItemGroup Label="Embedded Resources"> <EmbeddedResource Include="Properties\Resources.resx"> <GenerateSource>true</GenerateSource> <ClassName>System.SR</ClassName> </EmbeddedResource> <EmbeddedResource Include="..\..\Common\CommandLine\Resources\Strings.resx"> <GenerateSource>true</GenerateSource> <ClassName>Internal.CommandLine.Strings</ClassName> </EmbeddedResource> </ItemGroup> <ItemGroup> <ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" /> <ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" /> <ProjectReference Include="..\ILCompiler.ReadyToRun\ILCompiler.ReadyToRun.csproj" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Common\CommandLine\Argument.cs" /> <Compile Include="..\..\Common\CommandLine\Argument_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentCommand_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentLexer.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentList_1.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentParser.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntax_Definers.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentSyntaxException.cs" /> <Compile Include="..\..\Common\CommandLine\ArgumentToken.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineException.cs" /> <Compile Include="..\..\Common\CommandLine\CommandLineHelpers.cs" /> <Compile Include="..\..\Common\CommandLine\Enumerable.cs" /> <Compile Include="..\..\Common\CommandLine\HelpTextGenerator.cs" /> </ItemGroup> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'osx' and '$(TargetArchitecture)' == 'arm64'">unix_osx</TargetOSComponent> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' == ''">$(TargetArchitecture)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' != ''">$(CrossHostArch)</TargetArchitectureForSharedLibraries> <TargetArchitectureForSharedLibraries Condition="'$(TargetArchitectureForSharedLibraries)'=='armel'">arm</TargetArchitectureForSharedLibraries> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitectureForLocalJitBuild)' == ''">$(TargetArchitecture)</TargetArchitectureForLocalJitBuild> <TargetArchitectureForLocalJitBuild Condition="'$(TargetArchitecture)'=='armel'">arm</TargetArchitectureForLocalJitBuild> <TargetSpec>$(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries)</TargetSpec> <JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName> <!-- This will be provided when using the liveBuild, and unset otherwise. --> <CoreCLRArtifactsPath Condition="'$(CoreCLRArtifactsPath)' == ''">$(RuntimeBinDir)$(CrossHostArch)</CoreCLRArtifactsPath> </PropertyGroup> <ItemGroup> <Content Include="$(CoreCLRArtifactsPath)/$(JitInterfaceLibraryName)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> <Content Include="$(CoreCLRArtifactsPath)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> <ItemGroup Condition="'$(TargetOS)' == 'windows'"> <Content Include="$(RuntimeBinDir)/pgort*.dll" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" Condition="'$(PgoInstrument)' != ''" /> <PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativeVersion)" IsImplicitlyDefined="true" ExcludeAssets="all" GeneratePathProperty="true" /> </ItemGroup> <PropertyGroup Condition="'$(TargetOS)' == 'windows'"> <DiaSymReaderTargetArch>$(TargetArchitectureForSharedLibraries)</DiaSymReaderTargetArch> <DiaSymReaderTargetArch Condition="'$(DiaSymReaderTargetArch)' == 'x64'">amd64</DiaSymReaderTargetArch> <DiaSymReaderTargetArchFileName>Microsoft.DiaSymReader.Native.$(DiaSymReaderTargetArch).dll</DiaSymReaderTargetArchFileName> <DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' != ''">$(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> <!-- When publishing we won't have the NuGet packages, so use the copy from the build artifacts directory. --> <DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' == ''">$(CoreCLRArtifactsPath)crossgen2/$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath> </PropertyGroup> <ItemGroup Condition="'$(TargetOS)' == 'windows'"> <Content Include="$(DiaSymReaderTargetArchPath)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" /> </ItemGroup> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj
<Project> <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <Import Project="Sdk.props" Sdk="Microsoft.DotNet.SharedFramework.Sdk" /> <PropertyGroup> <SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</SkipBuild> <PlatformPackageType>RuntimePack</PlatformPackageType> <SharedFrameworkName>$(SharedFrameworkName).Crossgen2</SharedFrameworkName> <PgoSuffix Condition="'$(PgoInstrument)' != ''">.PGO</PgoSuffix> <OverridePackageId>$(SharedFrameworkName)$(PgoSuffix).$(RuntimeIdentifier)</OverridePackageId> <ArchiveName>dotnet-crossgen2</ArchiveName> <SharedFrameworkHostFileNameOverride>crossgen2</SharedFrameworkHostFileNameOverride> <!-- Build this pack for any RID if building from source. Otherwise, only build select RIDs. --> <RuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers> <GenerateInstallers>false</GenerateInstallers> <GetSharedFrameworkFilesForReadyToRunDependsOn> AddRuntimeFilesToPackage; AddFrameworkFilesToPackage </GetSharedFrameworkFilesForReadyToRunDependsOn> <PublishReadyToRun>true</PublishReadyToRun> <!-- Disable crossgen on NetBSD, illumos and Solaris for now. This can be revisited when we have full support. --> <PublishReadyToRun Condition="'$(TargetOS)'=='NetBSD' Or '$(TargetOS)'=='illumos' Or '$(TargetOS)'=='Solaris'">false</PublishReadyToRun> <!-- Disable crossgen on FreeBSD when cross building from Linux. --> <PublishReadyToRun Condition="'$(TargetOS)'=='FreeBSD' and '$(CrossBuild)'=='true'">false</PublishReadyToRun> <HostJsonTargetPath>tools/</HostJsonTargetPath> <PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion> </PropertyGroup> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetSpec>$(TargetOSComponent)-$(TargetArchitecture)</TargetSpec> </PropertyGroup> <ItemGroup> <NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)crossgen2$(ExeSuffix)" TargetPath="tools/" /> <Reference Include="$(CoreCLRCrossgen2Dir)crossgen2.dll" /> <Reference Include="$(CoreCLRCrossgen2Dir)ILCompiler*.dll" /> <Reference Condition="'$(DotNetBuildFromSource)' != 'true'" Include="$(CoreCLRCrossgen2Dir)Microsoft.DiaSymReader.dll" /> <NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)jitinterface_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_x86_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_universal_arm_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_x64_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_unix_x64_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_universal_arm64_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" /> <!-- Include the native hosting layer --> <NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)hostfxr$(LibSuffix)" TargetPath="tools/" /> <NativeRuntimeAsset Include="$(DotNetHostBinDir)/$(LibPrefix)hostpolicy$(LibSuffix)" TargetPath="tools/" /> </ItemGroup> <Target Name="AddRuntimeFilesToPackage" DependsOnTargets="ResolveRuntimeFilesFromLocalBuild"> <ItemGroup> <CrossgenFile Include="@(RuntimeFiles)" Condition="'%(Filename)' == 'crossgen'" /> <OptimizationDataFile Include="@(RuntimeFiles)" Condition="'%(Filename)' == 'StandardOptimizationData'" /> <ReferenceCopyLocalPaths Include="@(RuntimeFiles)" Exclude="@(CrossgenFile);@(OptimizationDataFile)" /> <ReferenceCopyLocalPaths TargetPath="tools/" /> </ItemGroup> </Target> <Target Name="AddFrameworkFilesToPackage" DependsOnTargets="ResolveLibrariesFromLocalBuild"> <ItemGroup> <ReferenceCopyLocalPaths Include="@(LibrariesRuntimeFiles)" TargetPath="tools/" /> </ItemGroup> </Target> <Target Name="AddCrossgen2SymbolFilesToPackage" BeforeTargets="GetFilesToPackage"> <ItemGroup> <_Crossgen2SymbolFilesToPackage Include="@(Reference->'$(CoreCLRArtifactsPath)PDB\%(FileName).pdb')" /> <!-- Symbol files for JIT libraries are placed in a different location for Windows builds --> <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> <_SymbolFilesToPackage Include="@(_Crossgen2SymbolFilesToPackage)" TargetPath="tools/" /> </ItemGroup> </Target> <PropertyGroup Condition="'$(TargetOS)' == 'windows'"> <!-- DiaSymReader for the target architecture, which is placed into the package --> <_diaSymTargetArch>$(TargetArchitecture)</_diaSymTargetArch> <_diaSymTargetArch Condition="'$(TargetArchitecture)' == 'x64'">amd64</_diaSymTargetArch> <_diaSymReaderTargetArchPath>$(PkgMicrosoft_DiaSymReader_Native)/runtimes/win/native/Microsoft.DiaSymReader.Native.$(_diaSymTargetArch).dll</_diaSymReaderTargetArchPath> </PropertyGroup> <ItemGroup Condition="Exists('$(_diaSymReaderTargetArchPath)')"> <NativeRuntimeAsset Include="$(_diaSymReaderTargetArchPath)" TargetPath="tools/" /> </ItemGroup> <Import Project="$(Crossgen2SdkOverridePropsPath)" /> <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.SharedFramework.Sdk" /> <Import Project="$(Crossgen2SdkOverrideTargetsPath)" /> <Import Project="ReadyToRun.targets" /> <Target Name="GetFilesToPublish"> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GetAllSharedFrameworkFiles" RemoveProperties="OutputPath;SymbolsOutputPath"> <Output TaskParameter="TargetOutputs" ItemName="_FilesToPackage" /> </MSBuild> <ItemGroup> <_PackagedFilesToPublish Include="@(_FilesToPackage)" Condition="'%(_FilesToPackage.PackOnly)' != 'true'" /> </ItemGroup> <ItemGroup> <FilesToPublish Include="@(_PackagedFilesToPublish)" TargetPath="" /> </ItemGroup> </Target> </Project>
<Project> <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> <Import Project="Sdk.props" Sdk="Microsoft.DotNet.SharedFramework.Sdk" /> <PropertyGroup> <!-- Crossgen is not used for Mono, and does not currently create freebsd packages --> <SkipBuild Condition="'$(RuntimeFlavor)' == 'Mono' or '$(RuntimeIdentifier)' == 'freebsd-x64'">true</SkipBuild> <PlatformPackageType>ToolPack</PlatformPackageType> <SharedFrameworkName>$(SharedFrameworkName).Crossgen2</SharedFrameworkName> <PgoSuffix Condition="'$(PgoInstrument)' != ''">.PGO</PgoSuffix> <OverridePackageId>$(SharedFrameworkName)$(PgoSuffix).$(RuntimeIdentifier)</OverridePackageId> <ArchiveName>dotnet-crossgen2</ArchiveName> <SharedFrameworkHostFileNameOverride>crossgen2</SharedFrameworkHostFileNameOverride> <!-- Build this pack for any RID if building from source. Otherwise, only build select RIDs. --> <RuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers> <GenerateInstallers>false</GenerateInstallers> <HostJsonTargetPath>tools/</HostJsonTargetPath> <PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion> <!-- Publishing as single-file or NativeAOT means we can't examine the interior DLLs --> <ShouldVerifyClosure>false</ShouldVerifyClosure> </PropertyGroup> <Target Name="PublishCrossgen" BeforeTargets="GetFilesToPackage"> <!-- Copy System.Private.CoreLib from the coreclr bin directory to the runtime pack directory, as we always need the copy of System.Private.CoreLib that matches exactly with the runtime. --> <Copy SourceFiles="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <MSBuild Projects="$(RepoRoot)src/coreclr/tools/aot/crossgen2/crossgen2.csproj" Properties="RunningPublish=true ;RuntimeIdentifier=$(RuntimeIdentifier) ;CoreCLRArtifactsPath=$(CoreCLRArtifactsPath) ;R2ROverridePath=$(MSBuildThisFileDirectory)ReadyToRun.targets" Targets="Restore;Publish;PublishItemsOutputGroup"> <Output TaskParameter="TargetOutputs" ItemName="_RawCrossgenPublishFiles" /> </MSBuild> <ItemGroup> <_CrossgenPublishFiles Include="@(_RawCrossgenPublishFiles->'%(OutputPath)')" KeepMetadata="REMOVE_ALL" /> </ItemGroup> <ItemGroup Condition="'$(NativeAotSupported)' != 'true'"> <FilesToPackage Include="@(_CrossgenPublishFiles)" Exclude="*.pdb;*.h;*.lib" TargetPath="tools/" /> </ItemGroup> <ItemGroup Condition="'$(NativeAotSupported)' == 'true'"> <!-- Treat all native aot assets as native runtime assets --> <FilesToPackage Include="@(_CrossgenPublishFiles->Distinct())" Condition="'%(Extension)' != '.pdb'" TargetPath="tools/" /> </ItemGroup> </Target> <Target Name="RunPublishedCrossgen" AfterTargets="PublishCrossgen" Condition="'$(TargetOs)' == '$(HostOs)' and '$(TargetArchitecture)' == '$(BuildArchitecture)'"> <!-- Run the published crossgen if we're not cross-compiling --> <Exec Command="@(FilesToPackage) $(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll --out $(IntermediateOutputPath)S.P.C.tmp" Condition="'%(FileName)%(Extension)' == 'crossgen2$(ExeSuffix)'" ConsoleToMsBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="CrossgenOutput" /> <Output TaskParameter="ExitCode" PropertyName="CrossgenExitCode" /> </Exec> <Error Text="Crossgen failed with code $(CrossgenExitCode), output: $(CrossgenOutput)" Condition="$(CrossgenExitCode) != 0" /> </Target> <PropertyGroup> <TargetOSComponent>unix</TargetOSComponent> <TargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</TargetOSComponent> <TargetSpec>$(TargetOSComponent)-$(TargetArchitecture)</TargetSpec> </PropertyGroup> <Target Name="AddCrossgen2SymbolFilesToPackage" BeforeTargets="GetFilesToPackage"> <ItemGroup> <_Crossgen2SymbolFilesToPackage Include="@(Reference->'$(CoreCLRArtifactsPath)PDB\%(FileName).pdb')" /> <!-- Symbol files for JIT libraries are placed in a different location for Windows builds --> <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> <_SymbolFilesToPackage Include="@(_Crossgen2SymbolFilesToPackage)" TargetPath="tools/" /> </ItemGroup> </Target> <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> <Import Project="Sdk.targets" Sdk="Microsoft.DotNet.SharedFramework.Sdk" /> <Target Name="GetFilesToPublish"> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_GetAllSharedFrameworkFiles" RemoveProperties="OutputPath;SymbolsOutputPath"> <Output TaskParameter="TargetOutputs" ItemName="_FilesToPackage" /> </MSBuild> <ItemGroup> <_PackagedFilesToPublish Include="@(_FilesToPackage)" Condition="'%(_FilesToPackage.PackOnly)' != 'true'" /> </ItemGroup> <ItemGroup> <FilesToPublish Include="@(_PackagedFilesToPublish)" TargetPath="" /> </ItemGroup> </Target> </Project>
1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/Generics/Parameters/instance_equalnull_class01.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; public struct ValX0 { } public struct ValY0 { } public struct ValX1<T> { } public struct ValY1<T> { } public struct ValX2<T, U> { } public struct ValY2<T, U> { } public struct ValX3<T, U, V> { } public struct ValY3<T, U, V> { } public class RefX0 { } public class RefY0 { } public class RefX1<T> { } public class RefY1<T> { } public class RefX2<T, U> { } public class RefY2<T, U> { } public class RefX3<T, U, V> { } public class RefY3<T, U, V> { } public class Gen<T> { public bool EqualNull(T t) { return ((object)t == null); } } public class Test_instance_equalnull_class01 { public static int counter = 0; public static bool result = true; public static void Eval(bool exp) { counter++; if (!exp) { result = exp; Console.WriteLine("Test Failed at location: " + counter); } } public static int Main() { int _int = 0; Eval(false == new Gen<int>().EqualNull(_int)); double _double = 0; Eval(false == new Gen<double>().EqualNull(_double)); Guid _Guid = new Guid(); Eval(false == new Gen<Guid>().EqualNull(_Guid)); string _string = "string"; Eval(false == new Gen<string>().EqualNull(_string)); Eval(true == new Gen<string>().EqualNull(null)); object _object = new object(); Eval(false == new Gen<object>().EqualNull(_string)); Eval(true == new Gen<object>().EqualNull(null)); if (result) { Console.WriteLine("Test Passed"); return 100; } else { Console.WriteLine("Test Failed"); return 1; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; public struct ValX0 { } public struct ValY0 { } public struct ValX1<T> { } public struct ValY1<T> { } public struct ValX2<T, U> { } public struct ValY2<T, U> { } public struct ValX3<T, U, V> { } public struct ValY3<T, U, V> { } public class RefX0 { } public class RefY0 { } public class RefX1<T> { } public class RefY1<T> { } public class RefX2<T, U> { } public class RefY2<T, U> { } public class RefX3<T, U, V> { } public class RefY3<T, U, V> { } public class Gen<T> { public bool EqualNull(T t) { return ((object)t == null); } } public class Test_instance_equalnull_class01 { public static int counter = 0; public static bool result = true; public static void Eval(bool exp) { counter++; if (!exp) { result = exp; Console.WriteLine("Test Failed at location: " + counter); } } public static int Main() { int _int = 0; Eval(false == new Gen<int>().EqualNull(_int)); double _double = 0; Eval(false == new Gen<double>().EqualNull(_double)); Guid _Guid = new Guid(); Eval(false == new Gen<Guid>().EqualNull(_Guid)); string _string = "string"; Eval(false == new Gen<string>().EqualNull(_string)); Eval(true == new Gen<string>().EqualNull(null)); object _object = new object(); Eval(false == new Gen<object>().EqualNull(_string)); Eval(true == new Gen<object>().EqualNull(null)); if (result) { Console.WriteLine("Test Passed"); return 100; } else { Console.WriteLine("Test Failed"); return 1; } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Reflection; using System.Globalization; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; #if USE_MDT_EVENTSOURCE using Microsoft.Diagnostics.Tracing; #else using System.Diagnostics.Tracing; #endif using Xunit; using Sdt = SdtEventSources; namespace BasicEventSourceTests { public class TestsManifestNegative { private static void AsserExceptionStringsEqual(Func<string> expectedStrFunc, Exception ex) { string expectedStr = expectedStrFunc(); Assert.Equal(ex.Message, expectedStr); } #region Message string building private static string GetResourceString(string key, params object[] args) { string fmt = GetResourceStringFromReflection(key); if (fmt != null) return string.Format(fmt, args); return key + " (" + string.Join(", ", args) + ")"; } private static string GetResourceStringFromReflection(string key) { BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (!PlatformDetection.IsNetFramework) { Type sr = typeof(EventSource).Assembly.GetType("System.SR", throwOnError: true, ignoreCase: false); PropertyInfo resourceProp = sr.GetProperty(key, flags); return (string)resourceProp.GetValue(null); } Type[] paramsType = new Type[] { typeof(string) }; MethodInfo getResourceString = typeof(Environment).GetMethod("GetResourceString", flags, null, paramsType, null); return (string)getResourceString.Invoke(null, new object[] { key }); } #endregion /// <summary> /// These tests use the NuGet EventSource to validate *both* NuGet and BCL user-defined EventSources /// For NuGet EventSources we validate both "runtime" and "validation" behavior /// </summary> [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "https://github.com/dotnet/runtime/issues/21421")] [ActiveIssue("https://github.com/dotnet/runtime/issues/51382", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void Test_GenerateManifest_InvalidEventSources() { TestUtilities.CheckNoEventSourcesRunning("Start"); // specify AllowEventSourceOverride - this is needed for Sdt event sources and won't make a difference for Sdt ones var strictOptions = EventManifestOptions.Strict | EventManifestOptions.AllowEventSourceOverride; Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty)); Exception e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TypeMustBeSealedOrAbstract"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TypeMustBeSealedOrAbstract"), e); // starting with NuGet we allow non-void returning methods as long as they have the [Event] attribute Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty)); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty, strictOptions)); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.OutOfRangeKwdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalKeywordsValue", "Kwd1", "0x100000000000"), GetResourceString("EventSource_KeywordCollision", "Session3", "Kwd1", "0x100000000000")), e); #if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS e = AssertExtensions.Throws<ArgumentException>(GetResourceString("EventSource_MaxChannelExceeded"), () => EventSource.GenerateManifest(typeof(Sdt.TooManyChannelsEventSource), string.Empty)); #endif if (PlatformDetection.IsWindows) { e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithAdminChannelNoMessageEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventWithAdminChannelMustHaveMessage", "WriteInteger", "Admin"), e); } e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ReservedOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalOpcodeValue", "Op1", 3), GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ReservedOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalOpcodeValue", "Op1", 3), GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EnumKindMismatch", "EventKeywords", "Opcodes"), GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger"), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty)); // These tests require the IL to be present for inspection. e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_MismatchIdToWriteEvent", "WriteInteger", 10, 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_MismatchIdToWriteEvent", "WriteInteger", 10, 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventNameReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventNameReused", "WriteInteger"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventNameReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventNameReused", "WriteInteger"), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 2, "WriteInteger1", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 2, "WriteInteger1", 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithInvalidMessageEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithInvalidMessageEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UnsupportedMessageProperty", "WriteString", "Message = {0,12:G}"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithKwdTaskOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Keywords"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Tasks"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Opcodes")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithKwdTaskOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Keywords"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Tasks"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Opcodes")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithEventsEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_AbstractMustNotDeclareEventMethods", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithEventsEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_AbstractMustNotDeclareEventMethods", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ImplementsInterfaceEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustNotBeExplicitImplementation", "SdtEventSources.ILogging.Error", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ImplementsInterfaceEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustNotBeExplicitImplementation", "SdtEventSources.ILogging.Error", 1), e); TestUtilities.CheckNoEventSourcesRunning("Stop"); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Reflection; using System.Globalization; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; #if USE_MDT_EVENTSOURCE using Microsoft.Diagnostics.Tracing; #else using System.Diagnostics.Tracing; #endif using Xunit; using Sdt = SdtEventSources; namespace BasicEventSourceTests { public class TestsManifestNegative { private static void AsserExceptionStringsEqual(Func<string> expectedStrFunc, Exception ex) { string expectedStr = expectedStrFunc(); Assert.Equal(ex.Message, expectedStr); } #region Message string building private static string GetResourceString(string key, params object[] args) { string fmt = GetResourceStringFromReflection(key); if (fmt != null) return string.Format(fmt, args); return key + " (" + string.Join(", ", args) + ")"; } private static string GetResourceStringFromReflection(string key) { BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (!PlatformDetection.IsNetFramework) { Type sr = typeof(EventSource).Assembly.GetType("System.SR", throwOnError: true, ignoreCase: false); PropertyInfo resourceProp = sr.GetProperty(key, flags); return (string)resourceProp.GetValue(null); } Type[] paramsType = new Type[] { typeof(string) }; MethodInfo getResourceString = typeof(Environment).GetMethod("GetResourceString", flags, null, paramsType, null); return (string)getResourceString.Invoke(null, new object[] { key }); } #endregion /// <summary> /// These tests use the NuGet EventSource to validate *both* NuGet and BCL user-defined EventSources /// For NuGet EventSources we validate both "runtime" and "validation" behavior /// </summary> [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "https://github.com/dotnet/runtime/issues/21421")] [ActiveIssue("https://github.com/dotnet/runtime/issues/51382", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void Test_GenerateManifest_InvalidEventSources() { TestUtilities.CheckNoEventSourcesRunning("Start"); // specify AllowEventSourceOverride - this is needed for Sdt event sources and won't make a difference for Sdt ones var strictOptions = EventManifestOptions.Strict | EventManifestOptions.AllowEventSourceOverride; Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty)); Exception e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TypeMustBeSealedOrAbstract"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.UnsealedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TypeMustBeSealedOrAbstract"), e); // starting with NuGet we allow non-void returning methods as long as they have the [Event] attribute Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty)); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty, strictOptions)); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithReturnEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.NegativeEventIdEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_NeedPositiveId"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.OutOfRangeKwdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalKeywordsValue", "Kwd1", "0x100000000000"), GetResourceString("EventSource_KeywordCollision", "Session3", "Kwd1", "0x100000000000")), e); #if FEATURE_ADVANCED_MANAGED_ETW_CHANNELS e = AssertExtensions.Throws<ArgumentException>(GetResourceString("EventSource_MaxChannelExceeded"), () => EventSource.GenerateManifest(typeof(Sdt.TooManyChannelsEventSource), string.Empty)); #endif if (PlatformDetection.IsWindows) { e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithAdminChannelNoMessageEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventWithAdminChannelMustHaveMessage", "WriteInteger", "Admin"), e); } e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ReservedOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalOpcodeValue", "Op1", 3), GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ReservedOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_IllegalOpcodeValue", "Op1", 3), GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EnumKindMismatch", "EventKeywords", "Opcodes"), GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EnumKindMismatchEventSource), string.Empty, EventManifestOptions.AllowEventSourceOverride)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UndefinedKeyword", "0x1", "WriteInteger"), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty)); // These tests require the IL to be present for inspection. e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_MismatchIdToWriteEvent", "WriteInteger", 10, 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.MismatchIdEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_MismatchIdToWriteEvent", "WriteInteger", 10, 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventIdReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_EventIdReused", "WriteInteger2", 1), GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 1, "WriteInteger1", 1)), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventNameReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventNameReused", "WriteInteger"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventNameReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventNameReused", "WriteInteger"), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 2, "WriteInteger1", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.TaskOpcodePairReusedEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_TaskOpcodePairReused", "WriteInteger2", 2, "WriteInteger1", 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithOpcodeNoTaskEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", "WriteInteger", 1), e); Assert.NotNull(EventSource.GenerateManifest(typeof(Sdt.EventWithInvalidMessageEventSource), string.Empty)); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.EventWithInvalidMessageEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_UnsupportedMessageProperty", "WriteString", "Message = {0,12:G}"), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithKwdTaskOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Keywords"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Tasks"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Opcodes")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithKwdTaskOpcodeEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => string.Join(Environment.NewLine, GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Keywords"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Tasks"), GetResourceString("EventSource_AbstractMustNotDeclareKTOC", "Opcodes")), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithEventsEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_AbstractMustNotDeclareEventMethods", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.AbstractWithEventsEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_AbstractMustNotDeclareEventMethods", "WriteInteger", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ImplementsInterfaceEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustNotBeExplicitImplementation", "SdtEventSources.ILogging.Error", 1), e); e = AssertExtensions.Throws<ArgumentException>(null, () => EventSource.GenerateManifest(typeof(Sdt.ImplementsInterfaceEventSource), string.Empty, strictOptions)); AsserExceptionStringsEqual(() => GetResourceString("EventSource_EventMustNotBeExplicitImplementation", "SdtEventSources.ILogging.Error", 1), e); TestUtilities.CheckNoEventSourcesRunning("Stop"); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/CustomImplementations.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Xml.Schema; namespace System.Xml.Tests { internal class ObservedNameTable : NameTable { public bool IsAddCalled = false; public bool IsGetCalled = false; public override string Get(char[] array, int offset, int length) { IsGetCalled = true; return base.Get(array, offset, length); } public override string Get(string array) { IsGetCalled = true; return base.Get(array); } public override string Add(char[] array, int offset, int length) { IsAddCalled = true; return base.Add(array, offset, length); } public override string Add(string array) { IsAddCalled = true; return base.Add(array); } } internal class ObservedNamespaceManager : XmlNamespaceManager { public ObservedNamespaceManager(XmlNameTable nt) : base(nt) { } public bool IsLookupNamespaceCalled = false; public override string LookupNamespace(string prefix) { IsLookupNamespaceCalled = true; return base.LookupNamespace(prefix); } public bool IsLookupPrefixCalled = false; public override string LookupPrefix(string uri) { IsLookupPrefixCalled = true; return base.LookupPrefix(uri); } public bool IsGetNamespacesInScopeCalled = false; public override IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope) { IsGetNamespacesInScopeCalled = true; return base.GetNamespacesInScope(scope); } } public enum ResolverEvent { SetCredentials, // Set Credentials CalledResolveUri, // Called ResolveUri CalledGetEntity, // Called GetEntity }; // ----------------- // Event Arguments // ----------------- public abstract class XmlTestResolverEventArgs : EventArgs { public abstract ResolverEvent EventType { get; } } internal class CResolverHolder { public bool IsCalledResolveUri = false; public bool IsCalledGetEntity = false; public void CallBackResolveUri(object sender, XmlTestResolverEventArgs args) { IsCalledResolveUri = true; } public void CallBackGetEntity(object sender, XmlTestResolverEventArgs args) { IsCalledGetEntity = true; } } internal class CDummyLineInfo : IXmlLineInfo { private int m_Number, m_Position; public CDummyLineInfo(int lineNumber, int linePosition) { m_Number = lineNumber; m_Position = linePosition; } public bool HasLineInfo() { return true; } public int LineNumber { get { return m_Number; } } public int LinePosition { get { return m_Position; } } } internal class CValidationEventHolder { public object lastObjectSent = null; public bool IsCalledA = false; public bool IsCalledB = false; public int NestingDepth = 0; public XmlSeverityType lastSeverity; public XmlSchemaValidationException lastException; public void CallbackA(object sender, ValidationEventArgs args) { lastObjectSent = sender; IsCalledA = true; lastSeverity = args.Severity; lastException = args.Exception as XmlSchemaValidationException; } public void CallbackB(object sender, ValidationEventArgs args) { lastObjectSent = sender; IsCalledB = true; lastSeverity = args.Severity; lastException = args.Exception as XmlSchemaValidationException; } public void CallbackNested(object sender, ValidationEventArgs args) { XmlSchemaInfo info = new XmlSchemaInfo(); (sender as XmlSchemaValidator).SkipToEndElement(info); if (NestingDepth < 3) { NestingDepth++; (sender as XmlSchemaValidator).ValidateElement("bar", "", info); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Xml.Schema; namespace System.Xml.Tests { internal class ObservedNameTable : NameTable { public bool IsAddCalled = false; public bool IsGetCalled = false; public override string Get(char[] array, int offset, int length) { IsGetCalled = true; return base.Get(array, offset, length); } public override string Get(string array) { IsGetCalled = true; return base.Get(array); } public override string Add(char[] array, int offset, int length) { IsAddCalled = true; return base.Add(array, offset, length); } public override string Add(string array) { IsAddCalled = true; return base.Add(array); } } internal class ObservedNamespaceManager : XmlNamespaceManager { public ObservedNamespaceManager(XmlNameTable nt) : base(nt) { } public bool IsLookupNamespaceCalled = false; public override string LookupNamespace(string prefix) { IsLookupNamespaceCalled = true; return base.LookupNamespace(prefix); } public bool IsLookupPrefixCalled = false; public override string LookupPrefix(string uri) { IsLookupPrefixCalled = true; return base.LookupPrefix(uri); } public bool IsGetNamespacesInScopeCalled = false; public override IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope) { IsGetNamespacesInScopeCalled = true; return base.GetNamespacesInScope(scope); } } public enum ResolverEvent { SetCredentials, // Set Credentials CalledResolveUri, // Called ResolveUri CalledGetEntity, // Called GetEntity }; // ----------------- // Event Arguments // ----------------- public abstract class XmlTestResolverEventArgs : EventArgs { public abstract ResolverEvent EventType { get; } } internal class CResolverHolder { public bool IsCalledResolveUri = false; public bool IsCalledGetEntity = false; public void CallBackResolveUri(object sender, XmlTestResolverEventArgs args) { IsCalledResolveUri = true; } public void CallBackGetEntity(object sender, XmlTestResolverEventArgs args) { IsCalledGetEntity = true; } } internal class CDummyLineInfo : IXmlLineInfo { private int m_Number, m_Position; public CDummyLineInfo(int lineNumber, int linePosition) { m_Number = lineNumber; m_Position = linePosition; } public bool HasLineInfo() { return true; } public int LineNumber { get { return m_Number; } } public int LinePosition { get { return m_Position; } } } internal class CValidationEventHolder { public object lastObjectSent = null; public bool IsCalledA = false; public bool IsCalledB = false; public int NestingDepth = 0; public XmlSeverityType lastSeverity; public XmlSchemaValidationException lastException; public void CallbackA(object sender, ValidationEventArgs args) { lastObjectSent = sender; IsCalledA = true; lastSeverity = args.Severity; lastException = args.Exception as XmlSchemaValidationException; } public void CallbackB(object sender, ValidationEventArgs args) { lastObjectSent = sender; IsCalledB = true; lastSeverity = args.Severity; lastException = args.Exception as XmlSchemaValidationException; } public void CallbackNested(object sender, ValidationEventArgs args) { XmlSchemaInfo info = new XmlSchemaInfo(); (sender as XmlSchemaValidator).SkipToEndElement(info); if (NestingDepth < 3) { NestingDepth++; (sender as XmlSchemaValidator).ValidateElement("bar", "", info); } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/ReflectionPatternContext.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using Mono.Cecil; using Mono.Cecil.Cil; namespace Mono.Linker.Dataflow { /// <summary> /// Helper struct to pass around context information about reflection pattern /// as a single parameter (and have a way to extend this in the future if we need to easily). /// Also implements a simple validation mechanism to check that the code does report patter recognition /// results for all methods it works on. /// The promise of the pattern recorder is that for a given reflection method, it will either not talk /// about it ever, or it will always report recognized/unrecognized. /// </summary> struct ReflectionPatternContext : IDisposable { readonly LinkContext _context; #if DEBUG bool _patternAnalysisAttempted; bool _patternReported; #endif public MessageOrigin Origin { get; init; } public ICustomAttributeProvider? Source { get => Origin.Provider; } public IMetadataTokenProvider MemberWithRequirements { get; init; } public Instruction? Instruction { get; init; } public bool ReportingEnabled { get; init; } public ReflectionPatternContext ( LinkContext context, bool reportingEnabled, in MessageOrigin origin, IMetadataTokenProvider memberWithRequirements, Instruction? instruction = null) { _context = context; ReportingEnabled = reportingEnabled; Origin = origin; MemberWithRequirements = memberWithRequirements; Instruction = instruction; #if DEBUG _patternAnalysisAttempted = false; _patternReported = false; #endif } #pragma warning disable CA1822 [Conditional ("DEBUG")] public void AnalyzingPattern () { #if DEBUG _patternAnalysisAttempted = true; #endif } [Conditional ("DEBUG")] public void RecordHandledPattern () { #if DEBUG _patternReported = true; #endif } #pragma warning restore CA1822 public void RecordRecognizedPattern (IMetadataTokenProvider accessedItem, Action mark) { #if DEBUG if (!_patternAnalysisAttempted) throw new InvalidOperationException ($"Internal error: To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first. {Source} -> {MemberWithRequirements}"); _patternReported = true; #endif mark (); if (ReportingEnabled) _context.ReflectionPatternRecorder.RecognizedReflectionAccessPattern (Source, Instruction, accessedItem); } public void RecordUnrecognizedPattern (int messageCode, string message) { #if DEBUG if (!_patternAnalysisAttempted) throw new InvalidOperationException ($"Internal error: To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first. {Source} -> {MemberWithRequirements}"); _patternReported = true; #endif if (ReportingEnabled) _context.ReflectionPatternRecorder.UnrecognizedReflectionAccessPattern (Origin, Source, Instruction, MemberWithRequirements, message, messageCode); } public void Dispose () { #if DEBUG if (_patternAnalysisAttempted && !_patternReported) throw new InvalidOperationException ($"Internal error: A reflection pattern was analyzed, but no result was reported. {Source} -> {MemberWithRequirements}"); #endif } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using Mono.Cecil; using Mono.Cecil.Cil; namespace Mono.Linker.Dataflow { /// <summary> /// Helper struct to pass around context information about reflection pattern /// as a single parameter (and have a way to extend this in the future if we need to easily). /// Also implements a simple validation mechanism to check that the code does report patter recognition /// results for all methods it works on. /// The promise of the pattern recorder is that for a given reflection method, it will either not talk /// about it ever, or it will always report recognized/unrecognized. /// </summary> struct ReflectionPatternContext : IDisposable { readonly LinkContext _context; #if DEBUG bool _patternAnalysisAttempted; bool _patternReported; #endif public MessageOrigin Origin { get; init; } public ICustomAttributeProvider? Source { get => Origin.Provider; } public IMetadataTokenProvider MemberWithRequirements { get; init; } public Instruction? Instruction { get; init; } public bool ReportingEnabled { get; init; } public ReflectionPatternContext ( LinkContext context, bool reportingEnabled, in MessageOrigin origin, IMetadataTokenProvider memberWithRequirements, Instruction? instruction = null) { _context = context; ReportingEnabled = reportingEnabled; Origin = origin; MemberWithRequirements = memberWithRequirements; Instruction = instruction; #if DEBUG _patternAnalysisAttempted = false; _patternReported = false; #endif } #pragma warning disable CA1822 [Conditional ("DEBUG")] public void AnalyzingPattern () { #if DEBUG _patternAnalysisAttempted = true; #endif } [Conditional ("DEBUG")] public void RecordHandledPattern () { #if DEBUG _patternReported = true; #endif } #pragma warning restore CA1822 public void RecordRecognizedPattern (IMetadataTokenProvider accessedItem, Action mark) { #if DEBUG if (!_patternAnalysisAttempted) throw new InvalidOperationException ($"Internal error: To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first. {Source} -> {MemberWithRequirements}"); _patternReported = true; #endif mark (); if (ReportingEnabled) _context.ReflectionPatternRecorder.RecognizedReflectionAccessPattern (Source, Instruction, accessedItem); } public void RecordUnrecognizedPattern (int messageCode, string message) { #if DEBUG if (!_patternAnalysisAttempted) throw new InvalidOperationException ($"Internal error: To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first. {Source} -> {MemberWithRequirements}"); _patternReported = true; #endif if (ReportingEnabled) _context.ReflectionPatternRecorder.UnrecognizedReflectionAccessPattern (Origin, Source, Instruction, MemberWithRequirements, message, messageCode); } public void Dispose () { #if DEBUG if (_patternAnalysisAttempted && !_patternReported) throw new InvalidOperationException ($"Internal error: A reflection pattern was analyzed, but no result was reported. {Source} -> {MemberWithRequirements}"); #endif } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/AddPairwiseWideningAndAdd.Vector64.Int16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddPairwiseWideningAndAdd_Vector64_Int16() { var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int16[] inArray2, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Int32> _fld1; public Vector64<Int16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref testStruct._fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 testClass) { var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 testClass) { fixed (Vector64<Int32>* pFld1 = &_fld1) fixed (Vector64<Int16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Int16[] _data2 = new Int16[Op2ElementCount]; private static Vector64<Int32> _clsVar1; private static Vector64<Int16> _clsVar2; private Vector64<Int32> _fld1; private Vector64<Int16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); } public SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.AddPairwiseWideningAndAdd( Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Int32>* pClsVar1 = &_clsVar1) fixed (Vector64<Int16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pClsVar1)), AdvSimd.LoadVector64((Int16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); fixed (Vector64<Int32>* pFld1 = &test._fld1) fixed (Vector64<Int16>* pFld2 = &test._fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Int32>* pFld1 = &_fld1) fixed (Vector64<Int16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(&test._fld1)), AdvSimd.LoadVector64((Int16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Int32> op1, Vector64<Int16> op2, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Int32[] left, Int16[] right, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.AddPairwiseWideningAndAdd(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AddPairwiseWideningAndAdd)}<Int32>(Vector64<Int32>, Vector64<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddPairwiseWideningAndAdd_Vector64_Int16() { var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int16[] inArray2, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Int32> _fld1; public Vector64<Int16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref testStruct._fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 testClass) { var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16 testClass) { fixed (Vector64<Int32>* pFld1 = &_fld1) fixed (Vector64<Int16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Int16[] _data2 = new Int16[Op2ElementCount]; private static Vector64<Int32> _clsVar1; private static Vector64<Int16> _clsVar2; private Vector64<Int32> _fld1; private Vector64<Int16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); } public SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.AddPairwiseWideningAndAdd( Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Int32>* pClsVar1 = &_clsVar1) fixed (Vector64<Int16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pClsVar1)), AdvSimd.LoadVector64((Int16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Int16>>(_dataTable.inArray2Ptr); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Int16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector64_Int16(); fixed (Vector64<Int32>* pFld1 = &test._fld1) fixed (Vector64<Int16>* pFld2 = &test._fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Int32>* pFld1 = &_fld1) fixed (Vector64<Int16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(pFld1)), AdvSimd.LoadVector64((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector64((Int32*)(&test._fld1)), AdvSimd.LoadVector64((Int16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Int32> op1, Vector64<Int16> op2, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Int32[] left, Int16[] right, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.AddPairwiseWideningAndAdd(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AddPairwiseWideningAndAdd)}<Int32>(Vector64<Int32>, Vector64<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Advapi32 { [LibraryImport(Libraries.Advapi32, EntryPoint = "CreateServiceW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType, int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, string servicesStartName, string password); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Advapi32 { [LibraryImport(Libraries.Advapi32, EntryPoint = "CreateServiceW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType, int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, string servicesStartName, string password); } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Add.Double.cs" /> <Compile Include="Add.Byte.cs" /> <Compile Include="Add.Int16.cs" /> <Compile Include="Add.Int32.cs" /> <Compile Include="Add.Int64.cs" /> <Compile Include="Add.SByte.cs" /> <Compile Include="Add.UInt16.cs" /> <Compile Include="Add.UInt32.cs" /> <Compile Include="Add.UInt64.cs" /> <Compile Include="AddSaturate.Byte.cs" /> <Compile Include="AddSaturate.SByte.cs" /> <Compile Include="AddSaturate.Int16.cs" /> <Compile Include="AddSaturate.UInt16.cs" /> <Compile Include="AddScalar.Double.cs" /> <Compile Include="And.Double.cs" /> <Compile Include="And.Byte.cs" /> <Compile Include="And.Int16.cs" /> <Compile Include="And.Int32.cs" /> <Compile Include="And.Int64.cs" /> <Compile Include="And.SByte.cs" /> <Compile Include="And.UInt16.cs" /> <Compile Include="And.UInt32.cs" /> <Compile Include="And.UInt64.cs" /> <Compile Include="AndNot.Double.cs" /> <Compile Include="AndNot.Byte.cs" /> <Compile Include="AndNot.Int16.cs" /> <Compile Include="AndNot.Int32.cs" /> <Compile Include="AndNot.Int64.cs" /> <Compile Include="AndNot.SByte.cs" /> <Compile Include="AndNot.UInt16.cs" /> <Compile Include="AndNot.UInt32.cs" /> <Compile Include="AndNot.UInt64.cs" /> <Compile Include="Average.Byte.cs" /> <Compile Include="Average.UInt16.cs" /> <Compile Include="CompareEqual.Double.cs" /> <Compile Include="CompareEqual.Byte.cs" /> <Compile Include="CompareEqual.Int16.cs" /> <Compile Include="CompareEqual.Int32.cs" /> <Compile Include="CompareEqual.SByte.cs" /> <Compile Include="CompareEqual.UInt16.cs" /> <Compile Include="CompareEqual.UInt32.cs" /> <Compile Include="CompareScalarEqual.Double.cs" /> <Compile Include="CompareScalarOrderedEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedEqual.Boolean.cs" /> <Compile Include="CompareGreaterThan.Double.cs" /> <Compile Include="CompareGreaterThan.Int16.cs" /> <Compile Include="CompareGreaterThan.Int32.cs" /> <Compile Include="CompareGreaterThan.SByte.cs" /> <Compile Include="CompareScalarGreaterThan.Double.cs" /> <Compile Include="CompareScalarOrderedGreaterThan.Boolean.cs" /> <Compile Include="CompareScalarUnorderedGreaterThan.Boolean.cs" /> <Compile Include="CompareGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarOrderedGreaterThanOrEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedGreaterThanOrEqual.Boolean.cs" /> <Compile Include="CompareLessThan.Double.cs" /> <Compile Include="CompareLessThan.Int16.cs" /> <Compile Include="CompareLessThan.Int32.cs" /> <Compile Include="CompareLessThan.SByte.cs" /> <Compile Include="CompareScalarLessThan.Double.cs" /> <Compile Include="CompareScalarOrderedLessThan.Boolean.cs" /> <Compile Include="CompareScalarUnorderedLessThan.Boolean.cs" /> <Compile Include="CompareLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarOrderedLessThanOrEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedLessThanOrEqual.Boolean.cs" /> <Compile Include="CompareNotEqual.Double.cs" /> <Compile Include="CompareScalarNotEqual.Double.cs" /> <Compile Include="CompareScalarOrderedNotEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedNotEqual.Boolean.cs" /> <Compile Include="CompareNotGreaterThan.Double.cs" /> <Compile Include="CompareScalarNotGreaterThan.Double.cs" /> <Compile Include="CompareNotGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarNotGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareNotLessThan.Double.cs" /> <Compile Include="CompareScalarNotLessThan.Double.cs" /> <Compile Include="CompareNotLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarNotLessThanOrEqual.Double.cs" /> <Compile Include="CompareOrdered.Double.cs" /> <Compile Include="CompareScalarOrdered.Double.cs" /> <Compile Include="CompareUnordered.Double.cs" /> <Compile Include="CompareScalarUnordered.Double.cs" /> <Compile Include="ConvertToInt32.Vector128Double.cs" /> <Compile Include="ConvertToInt32.Vector128Int32.cs" /> <Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" /> <Compile Include="ConvertToUInt32.Vector128UInt32.cs" /> <Compile Include="ConvertToVector128Double.Vector128Single.cs" /> <Compile Include="ConvertToVector128Double.Vector128Int32.cs" /> <Compile Include="ConvertToVector128Int32.Vector128Double.cs" /> <Compile Include="ConvertToVector128Int32.Vector128Single.cs" /> <Compile Include="ConvertToVector128Int32WithTruncation.Vector128Double.cs" /> <Compile Include="ConvertToVector128Int32WithTruncation.Vector128Single.cs" /> <Compile Include="ConvertToVector128Single.Vector128Double.cs" /> <Compile Include="ConvertToVector128Single.Vector128Int32.cs" /> <Compile Include="ConvertScalarToVector128Double.Double.cs" /> <Compile Include="ConvertScalarToVector128Int32.Int32.cs" /> <Compile Include="ConvertScalarToVector128UInt32.UInt32.cs" /> <Compile Include="Divide.Double.cs" /> <Compile Include="DivideScalar.Double.cs" /> <Compile Include="Extract.UInt16.1.cs" /> <Compile Include="Extract.UInt16.129.cs" /> <Compile Include="Insert.Int16.1.cs" /> <Compile Include="Insert.UInt16.1.cs" /> <Compile Include="Insert.Int16.129.cs" /> <Compile Include="Insert.UInt16.129.cs" /> <Compile Include="LoadVector128.Double.cs" /> <Compile Include="LoadVector128.Byte.cs" /> <Compile Include="LoadVector128.SByte.cs" /> <Compile Include="LoadVector128.Int16.cs" /> <Compile Include="LoadVector128.UInt16.cs" /> <Compile Include="LoadVector128.Int32.cs" /> <Compile Include="LoadVector128.UInt32.cs" /> <Compile Include="LoadVector128.Int64.cs" /> <Compile Include="LoadVector128.UInt64.cs" /> <Compile Include="LoadScalarVector128.Double.cs" /> <Compile Include="LoadScalarVector128.Int32.cs" /> <Compile Include="LoadScalarVector128.UInt32.cs" /> <Compile Include="LoadScalarVector128.Int64.cs" /> <Compile Include="LoadScalarVector128.UInt64.cs" /> <Compile Include="Max.Double.cs" /> <Compile Include="Max.Byte.cs" /> <Compile Include="Max.Int16.cs" /> <Compile Include="MaxScalar.Double.cs" /> <Compile Include="Min.Double.cs" /> <Compile Include="Min.Byte.cs" /> <Compile Include="Min.Int16.cs" /> <Compile Include="MinScalar.Double.cs" /> <Compile Include="Multiply.Double.cs" /> <Compile Include="MultiplyScalar.Double.cs" /> <Compile Include="MultiplyAddAdjacent.Int32.cs" /> <Compile Include="MultiplyLow.Int16.cs" /> <Compile Include="MultiplyLow.UInt16.cs" /> <Compile Include="MoveMask.Vector128Byte.cs" /> <Compile Include="MoveMask.Vector128SByte.cs" /> <Compile Include="MoveMask.Vector128Double.cs" /> <Compile Include="Or.Double.cs" /> <Compile Include="Or.Byte.cs" /> <Compile Include="Or.Int16.cs" /> <Compile Include="Or.Int32.cs" /> <Compile Include="Or.Int64.cs" /> <Compile Include="Or.SByte.cs" /> <Compile Include="Or.UInt16.cs" /> <Compile Include="Or.UInt32.cs" /> <Compile Include="Or.UInt64.cs" /> <Compile Include="PackSignedSaturate.Int16.cs" /> <Compile Include="PackSignedSaturate.SByte.cs" /> <Compile Include="PackUnsignedSaturate.Byte.cs" /> <Compile Include="ShiftLeftLogical.Int16.1.cs" /> <Compile Include="ShiftLeftLogical.UInt16.1.cs" /> <Compile Include="ShiftLeftLogical.Int32.1.cs" /> <Compile Include="ShiftLeftLogical.UInt32.1.cs" /> <Compile Include="ShiftLeftLogical.Int64.1.cs" /> <Compile Include="ShiftLeftLogical.UInt64.1.cs" /> <Compile Include="ShiftLeftLogical.Int16.16.cs" /> <Compile Include="ShiftLeftLogical.UInt16.16.cs" /> <Compile Include="ShiftLeftLogical.Int32.32.cs" /> <Compile Include="ShiftLeftLogical.UInt32.32.cs" /> <Compile Include="ShiftLeftLogical.Int64.64.cs" /> <Compile Include="ShiftLeftLogical.UInt64.64.cs" /> <Compile Include="ShiftLeftLogical128BitLane.SByte.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Byte.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int16.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt16.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int32.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt32.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int64.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt64.1.cs" /> <Compile Include="ShiftRightArithmetic.Int16.1.cs" /> <Compile Include="ShiftRightArithmetic.Int32.1.cs" /> <Compile Include="ShiftRightArithmetic.Int16.16.cs" /> <Compile Include="ShiftRightArithmetic.Int32.32.cs" /> <Compile Include="ShiftRightLogical.Int16.1.cs" /> <Compile Include="ShiftRightLogical.UInt16.1.cs" /> <Compile Include="ShiftRightLogical.Int32.1.cs" /> <Compile Include="ShiftRightLogical.UInt32.1.cs" /> <Compile Include="ShiftRightLogical.Int64.1.cs" /> <Compile Include="ShiftRightLogical.UInt64.1.cs" /> <Compile Include="ShiftRightLogical.Int16.16.cs" /> <Compile Include="ShiftRightLogical.UInt16.16.cs" /> <Compile Include="ShiftRightLogical.Int32.32.cs" /> <Compile Include="ShiftRightLogical.UInt32.32.cs" /> <Compile Include="ShiftRightLogical.Int64.64.cs" /> <Compile Include="ShiftRightLogical.UInt64.64.cs" /> <Compile Include="ShiftRightLogical128BitLane.SByte.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Byte.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int16.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt16.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int32.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt32.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int64.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt64.1.cs" /> <Compile Include="Shuffle.Int32.0.cs" /> <Compile Include="Shuffle.UInt32.0.cs" /> <Compile Include="Shuffle.Int32.1.cs" /> <Compile Include="Shuffle.UInt32.1.cs" /> <Compile Include="Shuffle.Double.0.cs" /> <Compile Include="Shuffle.Double.1.cs" /> <Compile Include="ShuffleHigh.Int16.0.cs" /> <Compile Include="ShuffleHigh.UInt16.0.cs" /> <Compile Include="ShuffleLow.Int16.0.cs" /> <Compile Include="ShuffleLow.UInt16.0.cs" /> <Compile Include="ShuffleHigh.Int16.1.cs" /> <Compile Include="ShuffleHigh.UInt16.1.cs" /> <Compile Include="ShuffleLow.Int16.1.cs" /> <Compile Include="ShuffleLow.UInt16.1.cs" /> <Compile Include="StoreScalar.Int32.cs" /> <Compile Include="StoreScalar.UInt32.cs" /> <Compile Include="Subtract.Double.cs" /> <Compile Include="Subtract.Byte.cs" /> <Compile Include="Subtract.Int16.cs" /> <Compile Include="Subtract.Int32.cs" /> <Compile Include="Subtract.Int64.cs" /> <Compile Include="Subtract.SByte.cs" /> <Compile Include="Subtract.UInt16.cs" /> <Compile Include="Subtract.UInt32.cs" /> <Compile Include="Subtract.UInt64.cs" /> <Compile Include="SubtractSaturate.Byte.cs" /> <Compile Include="SubtractSaturate.SByte.cs" /> <Compile Include="SubtractSaturate.Int16.cs" /> <Compile Include="SubtractSaturate.UInt16.cs" /> <Compile Include="SubtractScalar.Double.cs" /> <Compile Include="SumAbsoluteDifferences.UInt16.cs" /> <Compile Include="UnpackHigh.Double.cs" /> <Compile Include="UnpackHigh.Int64.cs" /> <Compile Include="UnpackHigh.UInt64.cs" /> <Compile Include="UnpackHigh.Int32.cs" /> <Compile Include="UnpackHigh.UInt32.cs" /> <Compile Include="UnpackHigh.Int16.cs" /> <Compile Include="UnpackHigh.UInt16.cs" /> <Compile Include="UnpackHigh.SByte.cs" /> <Compile Include="UnpackHigh.Byte.cs" /> <Compile Include="UnpackLow.Double.cs" /> <Compile Include="UnpackLow.Int64.cs" /> <Compile Include="UnpackLow.UInt64.cs" /> <Compile Include="UnpackLow.Int32.cs" /> <Compile Include="UnpackLow.UInt32.cs" /> <Compile Include="UnpackLow.Int16.cs" /> <Compile Include="UnpackLow.UInt16.cs" /> <Compile Include="UnpackLow.SByte.cs" /> <Compile Include="UnpackLow.Byte.cs" /> <Compile Include="Xor.Double.cs" /> <Compile Include="Xor.Byte.cs" /> <Compile Include="Xor.Int16.cs" /> <Compile Include="Xor.Int32.cs" /> <Compile Include="Xor.Int64.cs" /> <Compile Include="Xor.SByte.cs" /> <Compile Include="Xor.UInt16.cs" /> <Compile Include="Xor.UInt32.cs" /> <Compile Include="Xor.UInt64.cs" /> <Compile Include="Program.Sse2.cs" /> <Compile Include="..\Shared\Program.cs" /> <Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" /> <Compile Include="Sse2Verify.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Add.Double.cs" /> <Compile Include="Add.Byte.cs" /> <Compile Include="Add.Int16.cs" /> <Compile Include="Add.Int32.cs" /> <Compile Include="Add.Int64.cs" /> <Compile Include="Add.SByte.cs" /> <Compile Include="Add.UInt16.cs" /> <Compile Include="Add.UInt32.cs" /> <Compile Include="Add.UInt64.cs" /> <Compile Include="AddSaturate.Byte.cs" /> <Compile Include="AddSaturate.SByte.cs" /> <Compile Include="AddSaturate.Int16.cs" /> <Compile Include="AddSaturate.UInt16.cs" /> <Compile Include="AddScalar.Double.cs" /> <Compile Include="And.Double.cs" /> <Compile Include="And.Byte.cs" /> <Compile Include="And.Int16.cs" /> <Compile Include="And.Int32.cs" /> <Compile Include="And.Int64.cs" /> <Compile Include="And.SByte.cs" /> <Compile Include="And.UInt16.cs" /> <Compile Include="And.UInt32.cs" /> <Compile Include="And.UInt64.cs" /> <Compile Include="AndNot.Double.cs" /> <Compile Include="AndNot.Byte.cs" /> <Compile Include="AndNot.Int16.cs" /> <Compile Include="AndNot.Int32.cs" /> <Compile Include="AndNot.Int64.cs" /> <Compile Include="AndNot.SByte.cs" /> <Compile Include="AndNot.UInt16.cs" /> <Compile Include="AndNot.UInt32.cs" /> <Compile Include="AndNot.UInt64.cs" /> <Compile Include="Average.Byte.cs" /> <Compile Include="Average.UInt16.cs" /> <Compile Include="CompareEqual.Double.cs" /> <Compile Include="CompareEqual.Byte.cs" /> <Compile Include="CompareEqual.Int16.cs" /> <Compile Include="CompareEqual.Int32.cs" /> <Compile Include="CompareEqual.SByte.cs" /> <Compile Include="CompareEqual.UInt16.cs" /> <Compile Include="CompareEqual.UInt32.cs" /> <Compile Include="CompareScalarEqual.Double.cs" /> <Compile Include="CompareScalarOrderedEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedEqual.Boolean.cs" /> <Compile Include="CompareGreaterThan.Double.cs" /> <Compile Include="CompareGreaterThan.Int16.cs" /> <Compile Include="CompareGreaterThan.Int32.cs" /> <Compile Include="CompareGreaterThan.SByte.cs" /> <Compile Include="CompareScalarGreaterThan.Double.cs" /> <Compile Include="CompareScalarOrderedGreaterThan.Boolean.cs" /> <Compile Include="CompareScalarUnorderedGreaterThan.Boolean.cs" /> <Compile Include="CompareGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarOrderedGreaterThanOrEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedGreaterThanOrEqual.Boolean.cs" /> <Compile Include="CompareLessThan.Double.cs" /> <Compile Include="CompareLessThan.Int16.cs" /> <Compile Include="CompareLessThan.Int32.cs" /> <Compile Include="CompareLessThan.SByte.cs" /> <Compile Include="CompareScalarLessThan.Double.cs" /> <Compile Include="CompareScalarOrderedLessThan.Boolean.cs" /> <Compile Include="CompareScalarUnorderedLessThan.Boolean.cs" /> <Compile Include="CompareLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarOrderedLessThanOrEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedLessThanOrEqual.Boolean.cs" /> <Compile Include="CompareNotEqual.Double.cs" /> <Compile Include="CompareScalarNotEqual.Double.cs" /> <Compile Include="CompareScalarOrderedNotEqual.Boolean.cs" /> <Compile Include="CompareScalarUnorderedNotEqual.Boolean.cs" /> <Compile Include="CompareNotGreaterThan.Double.cs" /> <Compile Include="CompareScalarNotGreaterThan.Double.cs" /> <Compile Include="CompareNotGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareScalarNotGreaterThanOrEqual.Double.cs" /> <Compile Include="CompareNotLessThan.Double.cs" /> <Compile Include="CompareScalarNotLessThan.Double.cs" /> <Compile Include="CompareNotLessThanOrEqual.Double.cs" /> <Compile Include="CompareScalarNotLessThanOrEqual.Double.cs" /> <Compile Include="CompareOrdered.Double.cs" /> <Compile Include="CompareScalarOrdered.Double.cs" /> <Compile Include="CompareUnordered.Double.cs" /> <Compile Include="CompareScalarUnordered.Double.cs" /> <Compile Include="ConvertToInt32.Vector128Double.cs" /> <Compile Include="ConvertToInt32.Vector128Int32.cs" /> <Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" /> <Compile Include="ConvertToUInt32.Vector128UInt32.cs" /> <Compile Include="ConvertToVector128Double.Vector128Single.cs" /> <Compile Include="ConvertToVector128Double.Vector128Int32.cs" /> <Compile Include="ConvertToVector128Int32.Vector128Double.cs" /> <Compile Include="ConvertToVector128Int32.Vector128Single.cs" /> <Compile Include="ConvertToVector128Int32WithTruncation.Vector128Double.cs" /> <Compile Include="ConvertToVector128Int32WithTruncation.Vector128Single.cs" /> <Compile Include="ConvertToVector128Single.Vector128Double.cs" /> <Compile Include="ConvertToVector128Single.Vector128Int32.cs" /> <Compile Include="ConvertScalarToVector128Double.Double.cs" /> <Compile Include="ConvertScalarToVector128Int32.Int32.cs" /> <Compile Include="ConvertScalarToVector128UInt32.UInt32.cs" /> <Compile Include="Divide.Double.cs" /> <Compile Include="DivideScalar.Double.cs" /> <Compile Include="Extract.UInt16.1.cs" /> <Compile Include="Extract.UInt16.129.cs" /> <Compile Include="Insert.Int16.1.cs" /> <Compile Include="Insert.UInt16.1.cs" /> <Compile Include="Insert.Int16.129.cs" /> <Compile Include="Insert.UInt16.129.cs" /> <Compile Include="LoadVector128.Double.cs" /> <Compile Include="LoadVector128.Byte.cs" /> <Compile Include="LoadVector128.SByte.cs" /> <Compile Include="LoadVector128.Int16.cs" /> <Compile Include="LoadVector128.UInt16.cs" /> <Compile Include="LoadVector128.Int32.cs" /> <Compile Include="LoadVector128.UInt32.cs" /> <Compile Include="LoadVector128.Int64.cs" /> <Compile Include="LoadVector128.UInt64.cs" /> <Compile Include="LoadScalarVector128.Double.cs" /> <Compile Include="LoadScalarVector128.Int32.cs" /> <Compile Include="LoadScalarVector128.UInt32.cs" /> <Compile Include="LoadScalarVector128.Int64.cs" /> <Compile Include="LoadScalarVector128.UInt64.cs" /> <Compile Include="Max.Double.cs" /> <Compile Include="Max.Byte.cs" /> <Compile Include="Max.Int16.cs" /> <Compile Include="MaxScalar.Double.cs" /> <Compile Include="Min.Double.cs" /> <Compile Include="Min.Byte.cs" /> <Compile Include="Min.Int16.cs" /> <Compile Include="MinScalar.Double.cs" /> <Compile Include="Multiply.Double.cs" /> <Compile Include="MultiplyScalar.Double.cs" /> <Compile Include="MultiplyAddAdjacent.Int32.cs" /> <Compile Include="MultiplyLow.Int16.cs" /> <Compile Include="MultiplyLow.UInt16.cs" /> <Compile Include="MoveMask.Vector128Byte.cs" /> <Compile Include="MoveMask.Vector128SByte.cs" /> <Compile Include="MoveMask.Vector128Double.cs" /> <Compile Include="Or.Double.cs" /> <Compile Include="Or.Byte.cs" /> <Compile Include="Or.Int16.cs" /> <Compile Include="Or.Int32.cs" /> <Compile Include="Or.Int64.cs" /> <Compile Include="Or.SByte.cs" /> <Compile Include="Or.UInt16.cs" /> <Compile Include="Or.UInt32.cs" /> <Compile Include="Or.UInt64.cs" /> <Compile Include="PackSignedSaturate.Int16.cs" /> <Compile Include="PackSignedSaturate.SByte.cs" /> <Compile Include="PackUnsignedSaturate.Byte.cs" /> <Compile Include="ShiftLeftLogical.Int16.1.cs" /> <Compile Include="ShiftLeftLogical.UInt16.1.cs" /> <Compile Include="ShiftLeftLogical.Int32.1.cs" /> <Compile Include="ShiftLeftLogical.UInt32.1.cs" /> <Compile Include="ShiftLeftLogical.Int64.1.cs" /> <Compile Include="ShiftLeftLogical.UInt64.1.cs" /> <Compile Include="ShiftLeftLogical.Int16.16.cs" /> <Compile Include="ShiftLeftLogical.UInt16.16.cs" /> <Compile Include="ShiftLeftLogical.Int32.32.cs" /> <Compile Include="ShiftLeftLogical.UInt32.32.cs" /> <Compile Include="ShiftLeftLogical.Int64.64.cs" /> <Compile Include="ShiftLeftLogical.UInt64.64.cs" /> <Compile Include="ShiftLeftLogical128BitLane.SByte.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Byte.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int16.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt16.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int32.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt32.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.Int64.1.cs" /> <Compile Include="ShiftLeftLogical128BitLane.UInt64.1.cs" /> <Compile Include="ShiftRightArithmetic.Int16.1.cs" /> <Compile Include="ShiftRightArithmetic.Int32.1.cs" /> <Compile Include="ShiftRightArithmetic.Int16.16.cs" /> <Compile Include="ShiftRightArithmetic.Int32.32.cs" /> <Compile Include="ShiftRightLogical.Int16.1.cs" /> <Compile Include="ShiftRightLogical.UInt16.1.cs" /> <Compile Include="ShiftRightLogical.Int32.1.cs" /> <Compile Include="ShiftRightLogical.UInt32.1.cs" /> <Compile Include="ShiftRightLogical.Int64.1.cs" /> <Compile Include="ShiftRightLogical.UInt64.1.cs" /> <Compile Include="ShiftRightLogical.Int16.16.cs" /> <Compile Include="ShiftRightLogical.UInt16.16.cs" /> <Compile Include="ShiftRightLogical.Int32.32.cs" /> <Compile Include="ShiftRightLogical.UInt32.32.cs" /> <Compile Include="ShiftRightLogical.Int64.64.cs" /> <Compile Include="ShiftRightLogical.UInt64.64.cs" /> <Compile Include="ShiftRightLogical128BitLane.SByte.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Byte.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int16.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt16.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int32.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt32.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.Int64.1.cs" /> <Compile Include="ShiftRightLogical128BitLane.UInt64.1.cs" /> <Compile Include="Shuffle.Int32.0.cs" /> <Compile Include="Shuffle.UInt32.0.cs" /> <Compile Include="Shuffle.Int32.1.cs" /> <Compile Include="Shuffle.UInt32.1.cs" /> <Compile Include="Shuffle.Double.0.cs" /> <Compile Include="Shuffle.Double.1.cs" /> <Compile Include="ShuffleHigh.Int16.0.cs" /> <Compile Include="ShuffleHigh.UInt16.0.cs" /> <Compile Include="ShuffleLow.Int16.0.cs" /> <Compile Include="ShuffleLow.UInt16.0.cs" /> <Compile Include="ShuffleHigh.Int16.1.cs" /> <Compile Include="ShuffleHigh.UInt16.1.cs" /> <Compile Include="ShuffleLow.Int16.1.cs" /> <Compile Include="ShuffleLow.UInt16.1.cs" /> <Compile Include="StoreScalar.Int32.cs" /> <Compile Include="StoreScalar.UInt32.cs" /> <Compile Include="Subtract.Double.cs" /> <Compile Include="Subtract.Byte.cs" /> <Compile Include="Subtract.Int16.cs" /> <Compile Include="Subtract.Int32.cs" /> <Compile Include="Subtract.Int64.cs" /> <Compile Include="Subtract.SByte.cs" /> <Compile Include="Subtract.UInt16.cs" /> <Compile Include="Subtract.UInt32.cs" /> <Compile Include="Subtract.UInt64.cs" /> <Compile Include="SubtractSaturate.Byte.cs" /> <Compile Include="SubtractSaturate.SByte.cs" /> <Compile Include="SubtractSaturate.Int16.cs" /> <Compile Include="SubtractSaturate.UInt16.cs" /> <Compile Include="SubtractScalar.Double.cs" /> <Compile Include="SumAbsoluteDifferences.UInt16.cs" /> <Compile Include="UnpackHigh.Double.cs" /> <Compile Include="UnpackHigh.Int64.cs" /> <Compile Include="UnpackHigh.UInt64.cs" /> <Compile Include="UnpackHigh.Int32.cs" /> <Compile Include="UnpackHigh.UInt32.cs" /> <Compile Include="UnpackHigh.Int16.cs" /> <Compile Include="UnpackHigh.UInt16.cs" /> <Compile Include="UnpackHigh.SByte.cs" /> <Compile Include="UnpackHigh.Byte.cs" /> <Compile Include="UnpackLow.Double.cs" /> <Compile Include="UnpackLow.Int64.cs" /> <Compile Include="UnpackLow.UInt64.cs" /> <Compile Include="UnpackLow.Int32.cs" /> <Compile Include="UnpackLow.UInt32.cs" /> <Compile Include="UnpackLow.Int16.cs" /> <Compile Include="UnpackLow.UInt16.cs" /> <Compile Include="UnpackLow.SByte.cs" /> <Compile Include="UnpackLow.Byte.cs" /> <Compile Include="Xor.Double.cs" /> <Compile Include="Xor.Byte.cs" /> <Compile Include="Xor.Int16.cs" /> <Compile Include="Xor.Int32.cs" /> <Compile Include="Xor.Int64.cs" /> <Compile Include="Xor.SByte.cs" /> <Compile Include="Xor.UInt16.cs" /> <Compile Include="Xor.UInt32.cs" /> <Compile Include="Xor.UInt64.cs" /> <Compile Include="Program.Sse2.cs" /> <Compile Include="..\Shared\Program.cs" /> <Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" /> <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" /> <Compile Include="Sse2Verify.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int32.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void CreateScalarUnsafeInt32() { var test = new VectorCreate__CreateScalarUnsafeInt32(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateScalarUnsafeInt32 { private static readonly int LargestVectorSize = 8; private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Int32 value = TestLibrary.Generator.GetInt32(); Vector64<Int32> result = Vector64.CreateScalarUnsafe(value); ValidateResult(result, value); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Int32 value = TestLibrary.Generator.GetInt32(); object result = typeof(Vector64) .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Int32) }) .Invoke(null, new object[] { value }); ValidateResult((Vector64<Int32>)(result), value); } private void ValidateResult(Vector64<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "") { Int32[] resultElements = new Int32[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedValue, method); } private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "") { bool succeeded = true; if (resultElements[0] != expectedValue) { succeeded = false; } else { for (var i = 1; i < ElementCount; i++) { if (false /* value is uninitialized */) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Int32): {method} failed:"); TestLibrary.TestFramework.LogInformation($" value: {expectedValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void CreateScalarUnsafeInt32() { var test = new VectorCreate__CreateScalarUnsafeInt32(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateScalarUnsafeInt32 { private static readonly int LargestVectorSize = 8; private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Int32 value = TestLibrary.Generator.GetInt32(); Vector64<Int32> result = Vector64.CreateScalarUnsafe(value); ValidateResult(result, value); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Int32 value = TestLibrary.Generator.GetInt32(); object result = typeof(Vector64) .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Int32) }) .Invoke(null, new object[] { value }); ValidateResult((Vector64<Int32>)(result), value); } private void ValidateResult(Vector64<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "") { Int32[] resultElements = new Int32[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedValue, method); } private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "") { bool succeeded = true; if (resultElements[0] != expectedValue) { succeeded = false; } else { for (var i = 1; i < ElementCount; i++) { if (false /* value is uninitialized */) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Int32): {method} failed:"); TestLibrary.TestFramework.LogInformation($" value: {expectedValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Configuration.ConfigurationManager/tests/Mono/CommaDelimitedStringCollectionConverterTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // System.Configuration.CommaDelimitedStringCollectionConverterTest.cs - Unit tests // for System.Configuration.CommaDelimitedStringCollectionConverter. // // Author: // Chris Toshok <[email protected]> // // Copyright (C) 2005 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; using System.Configuration; using Xunit; namespace MonoTests.System.Configuration { public class CommaDelimitedStringCollectionConverterTest { [Fact] public void CanConvertFrom() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.True(cv.CanConvertFrom(null, typeof(string)), "A1"); Assert.False(cv.CanConvertFrom(null, typeof(TimeSpan)), "A2"); Assert.False(cv.CanConvertFrom(null, typeof(int)), "A3"); Assert.False(cv.CanConvertFrom(null, typeof(object)), "A4"); } [Fact] public void CanConvertTo() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.True(cv.CanConvertTo(null, typeof(string)), "A1"); Assert.False(cv.CanConvertTo(null, typeof(TimeSpan)), "A2"); Assert.False(cv.CanConvertTo(null, typeof(int)), "A3"); Assert.False(cv.CanConvertTo(null, typeof(object)), "A4"); } [Fact] public void ConvertFrom() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); object o; CommaDelimitedStringCollection col; o = cv.ConvertFrom(null, null, "hi,bye"); Assert.Equal(typeof(CommaDelimitedStringCollection), o.GetType()); col = (CommaDelimitedStringCollection)o; Assert.Equal(2, col.Count); Assert.Equal("hi", col[0]); Assert.Equal("bye", col[1]); col = (CommaDelimitedStringCollection)cv.ConvertFrom(null, null, "hi, bye"); Assert.Equal(2, col.Count); Assert.Equal("hi", col[0]); Assert.Equal("bye", col[1]); } [Fact] public void ConvertFrom_TypeError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); object o = null; Assert.Throws<InvalidCastException>(() => o = cv.ConvertFrom(null, null, 59)); Assert.Null(o); } [Fact] public void ConvertTo() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); CommaDelimitedStringCollection col = new CommaDelimitedStringCollection(); col.Add("hi"); col.Add("bye"); Assert.Equal("hi,bye", cv.ConvertTo(null, null, col, typeof(string))); } [Fact] public void ConvertTo_NullError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.Null(cv.ConvertTo(null, null, null, typeof(string))); } [Fact] public void ConvertTo_TypeError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, 59, typeof(string))); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // System.Configuration.CommaDelimitedStringCollectionConverterTest.cs - Unit tests // for System.Configuration.CommaDelimitedStringCollectionConverter. // // Author: // Chris Toshok <[email protected]> // // Copyright (C) 2005 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; using System.Configuration; using Xunit; namespace MonoTests.System.Configuration { public class CommaDelimitedStringCollectionConverterTest { [Fact] public void CanConvertFrom() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.True(cv.CanConvertFrom(null, typeof(string)), "A1"); Assert.False(cv.CanConvertFrom(null, typeof(TimeSpan)), "A2"); Assert.False(cv.CanConvertFrom(null, typeof(int)), "A3"); Assert.False(cv.CanConvertFrom(null, typeof(object)), "A4"); } [Fact] public void CanConvertTo() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.True(cv.CanConvertTo(null, typeof(string)), "A1"); Assert.False(cv.CanConvertTo(null, typeof(TimeSpan)), "A2"); Assert.False(cv.CanConvertTo(null, typeof(int)), "A3"); Assert.False(cv.CanConvertTo(null, typeof(object)), "A4"); } [Fact] public void ConvertFrom() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); object o; CommaDelimitedStringCollection col; o = cv.ConvertFrom(null, null, "hi,bye"); Assert.Equal(typeof(CommaDelimitedStringCollection), o.GetType()); col = (CommaDelimitedStringCollection)o; Assert.Equal(2, col.Count); Assert.Equal("hi", col[0]); Assert.Equal("bye", col[1]); col = (CommaDelimitedStringCollection)cv.ConvertFrom(null, null, "hi, bye"); Assert.Equal(2, col.Count); Assert.Equal("hi", col[0]); Assert.Equal("bye", col[1]); } [Fact] public void ConvertFrom_TypeError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); object o = null; Assert.Throws<InvalidCastException>(() => o = cv.ConvertFrom(null, null, 59)); Assert.Null(o); } [Fact] public void ConvertTo() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); CommaDelimitedStringCollection col = new CommaDelimitedStringCollection(); col.Add("hi"); col.Add("bye"); Assert.Equal("hi,bye", cv.ConvertTo(null, null, col, typeof(string))); } [Fact] public void ConvertTo_NullError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); Assert.Null(cv.ConvertTo(null, null, null, typeof(string))); } [Fact] public void ConvertTo_TypeError() { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter(); AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, 59, typeof(string))); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/Common/src/SkipLocalsInit.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Used to indicate to the compiler that the .locals init flag should not be set in method headers. [module: System.Runtime.CompilerServices.SkipLocalsInit]
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Used to indicate to the compiler that the .locals init flag should not be set in method headers. [module: System.Runtime.CompilerServices.SkipLocalsInit]
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector256/CreateVector.SByte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void CreateVectorSByte() { var test = new VectorCreate__CreateVectorSByte(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateVectorSByte { private static readonly int LargestVectorSize = 32; private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); SByte lowerValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> lower = Vector128.Create(lowerValue); SByte upperValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> upper = Vector128.Create(upperValue); Vector256<SByte> result = Vector256.Create(lower, upper); ValidateResult(result, lowerValue, upperValue); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); SByte lowerValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> lower = Vector128.Create(lowerValue); SByte upperValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> upper = Vector128.Create(upperValue); object result = typeof(Vector256) .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }) .Invoke(null, new object[] { lower, upper }); ValidateResult((Vector256<SByte>)(result), lowerValue, upperValue); } private void ValidateResult(Vector256<SByte> result, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "") { SByte[] resultElements = new SByte[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method); } private void ValidateResult(SByte[] resultElements, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < ElementCount / 2; i++) { if (resultElements[i] != expectedLowerValue) { succeeded = false; break; } } for (var i = ElementCount / 2; i < ElementCount; i++) { if (resultElements[i] != expectedUpperValue) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector256.Create(SByte): {method} failed:"); TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}"); TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void CreateVectorSByte() { var test = new VectorCreate__CreateVectorSByte(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateVectorSByte { private static readonly int LargestVectorSize = 32; private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); SByte lowerValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> lower = Vector128.Create(lowerValue); SByte upperValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> upper = Vector128.Create(upperValue); Vector256<SByte> result = Vector256.Create(lower, upper); ValidateResult(result, lowerValue, upperValue); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); SByte lowerValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> lower = Vector128.Create(lowerValue); SByte upperValue = TestLibrary.Generator.GetSByte(); Vector128<SByte> upper = Vector128.Create(upperValue); object result = typeof(Vector256) .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }) .Invoke(null, new object[] { lower, upper }); ValidateResult((Vector256<SByte>)(result), lowerValue, upperValue); } private void ValidateResult(Vector256<SByte> result, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "") { SByte[] resultElements = new SByte[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method); } private void ValidateResult(SByte[] resultElements, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < ElementCount / 2; i++) { if (resultElements[i] != expectedLowerValue) { succeeded = false; break; } } for (var i = ElementCount / 2; i < ElementCount; i++) { if (resultElements[i] != expectedUpperValue) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector256.Create(SByte): {method} failed:"); TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}"); TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/CodeGenBringUpTests/LeftShift_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="LeftShift.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="LeftShift.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Net.Sockets/src/System/Net/Sockets/SelectMode.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Net.Sockets { // Specifies the mode for polling the status of a socket. public enum SelectMode { // Poll the read status of a socket. SelectRead = 0, // Poll the write status of a socket. SelectWrite = 1, // Poll the error status of a socket. SelectError = 2 } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Net.Sockets { // Specifies the mode for polling the status of a socket. public enum SelectMode { // Poll the read status of a socket. SelectRead = 0, // Poll the write status of a socket. SelectWrite = 1, // Poll the error status of a socket. SelectError = 2 } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/CodeGenBringUpTests/Array1_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Array1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Array1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/CodeGenBringUpTests/LocallocCnstB5001_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="LocallocCnstB5001.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="LocallocCnstB5001.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/CodeGenBringUpTests/Lt1_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Lt1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Lt1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/coreclr/tools/runincontext/runincontext.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <RuntimeFrameworkVersion>$(MicrosoftNETCoreAppRuntimewinx64Version)</RuntimeFrameworkVersion> <UseAppHost>false</UseAppHost> <CLRTestKind>BuildOnly</CLRTestKind> <OutputPath>$(RuntimeBinDir)</OutputPath> </PropertyGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework> <RuntimeFrameworkVersion>$(MicrosoftNETCoreAppRuntimewinx64Version)</RuntimeFrameworkVersion> <UseAppHost>false</UseAppHost> <CLRTestKind>BuildOnly</CLRTestKind> <OutputPath>$(RuntimeBinDir)</OutputPath> </PropertyGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/Loader/classloader/generics/Variance/IL/Unbox006.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; public class Base {} public class Sub : Base {} public class GBase<T> {} public class GSubT<T> : GBase<T> {} public struct GTU<T,U> : IPlusT<T>, IMinusT<U>, IPlusTMinusU<T,U> {} public struct GTArrUArr<T,U> : IPlusT<T[]>, IMinusT<U[]>, IPlusTMinusU<T[],U[]> {} public struct GRefTRefU<T,U> : IPlusT<IPlusT<T>>, IPlusT<IMinusT<U>>, IPlusTMinusU<IPlusT<T>, IPlusT<U>> {} public struct GRefTArrRefUArr<T,U> : IPlusT<IPlusT<T[]>>, IPlusT<IMinusT<U[]>>, IPlusTMinusU<IPlusT<T[]>,IPlusT<U[]>> {} public struct GArrRefTArrRefU<T,U> : IPlusT<IPlusT<T>[]>, IPlusT<IMinusT<U>[]>, IPlusTMinusU<IPlusT<T>[],IPlusT<U>[]> {} public class TestClass { static int iTestCount= 0; static int iErrorCount= 0; static int iExitCode = 101; public static void Eval(string location, bool exp) { ++iTestCount; if ( !(exp)) { iErrorCount++; Console.WriteLine("Test Failed at location: {0} @ count {1} ", location, iTestCount); } } private static void UnboxUToTInternal<T,U>() { T t = (T) Activator.CreateInstance(typeof(U)); } private static void CaseClassUToTWrapper<T,U>() { UnboxUToTInternal<T,U>(); } public static bool UnboxUToT<T,U>(bool expected) { try { CaseClassUToTWrapper<T,U>(); if (expected) { return true; } else { return false; } } catch (InvalidCastException) { if (expected) { Console.WriteLine("Unexpected Exception InvalidCastException"); return false; } else { return true; } } catch(Exception E) { Console.WriteLine("Unexpected Exception {0}, with T = {1} and U = {2}", E, typeof(T), typeof(U)); return false; } } private static bool RunTests() { Eval("Test001", UnboxUToT<IPlusT<Sub>, GTU<Base,Sub>>(false)); Eval("Test002", UnboxUToT<IMinusT<Base>, GTU<Base,Sub>>(false)); Eval("Test003", UnboxUToT<IPlusTMinusU<Sub,Base>, GTU<Base,Sub>>(false)); Eval("Test004", UnboxUToT<IPlusT<Sub[]>, GTU<Base[],Sub[]>>(false)); Eval("Test005", UnboxUToT<IMinusT<Base[]>, GTU<Base[],Sub[]>>(false)); Eval("Test006", UnboxUToT<IPlusTMinusU<Sub[],Base[]>, GTU<Base[],Sub[]>>(false)); Eval("Test007", UnboxUToT<IPlusT<GSubT<int>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test008", UnboxUToT<IMinusT<GBase<string>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test009", UnboxUToT<IPlusTMinusU<GSubT<int>,GBase<string>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test010", UnboxUToT<IPlusT<GSubT<int>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test011", UnboxUToT<IMinusT<GBase<string>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test012", UnboxUToT<IPlusTMinusU<GSubT<int>[],GBase<string>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test101", UnboxUToT<IPlusT<Sub[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test102", UnboxUToT<IMinusT<Base[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test103", UnboxUToT<IPlusTMinusU<Sub[],Base[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test104", UnboxUToT<IPlusT<Sub[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test105", UnboxUToT<IMinusT<Base[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test106", UnboxUToT<IPlusTMinusU<Sub[][],Base[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test107", UnboxUToT<IPlusT<GSubT<int>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test108", UnboxUToT<IMinusT<GBase<string>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test109", UnboxUToT<IPlusTMinusU<GSubT<int>[],GBase<string>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test110", UnboxUToT<IPlusT<GSubT<int>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test111", UnboxUToT<IMinusT<GBase<string>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test112", UnboxUToT<IPlusTMinusU<GSubT<int>[][],GBase<string>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test201", UnboxUToT<IPlusT<IPlusT<Sub>>, GRefTRefU<Base,Sub>>(false)); Eval("Test202", UnboxUToT<IPlusT<IMinusT<Base>>, GRefTRefU<Base,Sub>>(false)); Eval("Test203", UnboxUToT<IPlusTMinusU<IPlusT<Sub>,IPlusT<Base>>, GRefTRefU<Base,Sub>>(false)); Eval("Test204", UnboxUToT<IPlusT<IPlusT<Sub[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test205", UnboxUToT<IPlusT<IMinusT<Base[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test206", UnboxUToT<IPlusTMinusU<IPlusT<Sub[]>,IPlusT<Base[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test207", UnboxUToT<IPlusT<IPlusT<GSubT<int>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test208", UnboxUToT<IPlusT<IMinusT<GBase<string>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test209", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>>,IPlusT<GBase<string>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test210", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test211", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test212", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>,IPlusT<GBase<string>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test301", UnboxUToT<IPlusT<IPlusT<Sub[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test302", UnboxUToT<IPlusT<IMinusT<Base[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test303", UnboxUToT<IPlusTMinusU<IPlusT<Sub[]>,IPlusT<Base[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test304", UnboxUToT<IPlusT<IPlusT<Sub[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test305", UnboxUToT<IPlusT<IMinusT<Base[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test306", UnboxUToT<IPlusTMinusU<IPlusT<Sub[][]>,IPlusT<Base[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test307", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test308", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test309", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>,IPlusT<GBase<string>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test310", UnboxUToT<IPlusT<IPlusT<GSubT<int>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test311", UnboxUToT<IPlusT<IMinusT<GBase<string>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test312", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[][]>,IPlusT<GBase<string>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test401", UnboxUToT<IPlusT<IPlusT<Sub>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test402", UnboxUToT<IPlusT<IMinusT<Base>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test403", UnboxUToT<IPlusTMinusU<IPlusT<Sub>[],IPlusT<Base>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test404", UnboxUToT<IPlusT<IPlusT<Sub[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test405", UnboxUToT<IPlusT<IMinusT<Base[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test406", UnboxUToT<IPlusTMinusU<IPlusT<Sub[,]>[],IPlusT<Base[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test407", UnboxUToT<IPlusT<IPlusT<GSubT<int>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test408", UnboxUToT<IPlusT<IMinusT<GBase<string>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test409", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>>[],IPlusT<GBase<string>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test410", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test411", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test412", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>[],IPlusT<GBase<string>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); if( iErrorCount > 0 ) { Console.WriteLine( "Total test cases: " + iTestCount + " Failed test cases: " + iErrorCount ); return false; } else { Console.WriteLine( "Total test cases: " + iTestCount ); return true; } } public static int Main(String [] args) { if( RunTests() ) { iExitCode = 100; Console.WriteLine( "All test cases passed" ); } else { iExitCode = 101; Console.WriteLine( "Test failed" ); } return iExitCode; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; public class Base {} public class Sub : Base {} public class GBase<T> {} public class GSubT<T> : GBase<T> {} public struct GTU<T,U> : IPlusT<T>, IMinusT<U>, IPlusTMinusU<T,U> {} public struct GTArrUArr<T,U> : IPlusT<T[]>, IMinusT<U[]>, IPlusTMinusU<T[],U[]> {} public struct GRefTRefU<T,U> : IPlusT<IPlusT<T>>, IPlusT<IMinusT<U>>, IPlusTMinusU<IPlusT<T>, IPlusT<U>> {} public struct GRefTArrRefUArr<T,U> : IPlusT<IPlusT<T[]>>, IPlusT<IMinusT<U[]>>, IPlusTMinusU<IPlusT<T[]>,IPlusT<U[]>> {} public struct GArrRefTArrRefU<T,U> : IPlusT<IPlusT<T>[]>, IPlusT<IMinusT<U>[]>, IPlusTMinusU<IPlusT<T>[],IPlusT<U>[]> {} public class TestClass { static int iTestCount= 0; static int iErrorCount= 0; static int iExitCode = 101; public static void Eval(string location, bool exp) { ++iTestCount; if ( !(exp)) { iErrorCount++; Console.WriteLine("Test Failed at location: {0} @ count {1} ", location, iTestCount); } } private static void UnboxUToTInternal<T,U>() { T t = (T) Activator.CreateInstance(typeof(U)); } private static void CaseClassUToTWrapper<T,U>() { UnboxUToTInternal<T,U>(); } public static bool UnboxUToT<T,U>(bool expected) { try { CaseClassUToTWrapper<T,U>(); if (expected) { return true; } else { return false; } } catch (InvalidCastException) { if (expected) { Console.WriteLine("Unexpected Exception InvalidCastException"); return false; } else { return true; } } catch(Exception E) { Console.WriteLine("Unexpected Exception {0}, with T = {1} and U = {2}", E, typeof(T), typeof(U)); return false; } } private static bool RunTests() { Eval("Test001", UnboxUToT<IPlusT<Sub>, GTU<Base,Sub>>(false)); Eval("Test002", UnboxUToT<IMinusT<Base>, GTU<Base,Sub>>(false)); Eval("Test003", UnboxUToT<IPlusTMinusU<Sub,Base>, GTU<Base,Sub>>(false)); Eval("Test004", UnboxUToT<IPlusT<Sub[]>, GTU<Base[],Sub[]>>(false)); Eval("Test005", UnboxUToT<IMinusT<Base[]>, GTU<Base[],Sub[]>>(false)); Eval("Test006", UnboxUToT<IPlusTMinusU<Sub[],Base[]>, GTU<Base[],Sub[]>>(false)); Eval("Test007", UnboxUToT<IPlusT<GSubT<int>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test008", UnboxUToT<IMinusT<GBase<string>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test009", UnboxUToT<IPlusTMinusU<GSubT<int>,GBase<string>>, GTU<GBase<int>,GSubT<string>>>(false)); Eval("Test010", UnboxUToT<IPlusT<GSubT<int>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test011", UnboxUToT<IMinusT<GBase<string>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test012", UnboxUToT<IPlusTMinusU<GSubT<int>[],GBase<string>[]>, GTU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test101", UnboxUToT<IPlusT<Sub[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test102", UnboxUToT<IMinusT<Base[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test103", UnboxUToT<IPlusTMinusU<Sub[],Base[]>, GTArrUArr<Base,Sub>>(false)); Eval("Test104", UnboxUToT<IPlusT<Sub[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test105", UnboxUToT<IMinusT<Base[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test106", UnboxUToT<IPlusTMinusU<Sub[][],Base[][]>, GTArrUArr<Base[],Sub[]>>(false)); Eval("Test107", UnboxUToT<IPlusT<GSubT<int>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test108", UnboxUToT<IMinusT<GBase<string>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test109", UnboxUToT<IPlusTMinusU<GSubT<int>[],GBase<string>[]>, GTArrUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test110", UnboxUToT<IPlusT<GSubT<int>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test111", UnboxUToT<IMinusT<GBase<string>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test112", UnboxUToT<IPlusTMinusU<GSubT<int>[][],GBase<string>[][]>, GTArrUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test201", UnboxUToT<IPlusT<IPlusT<Sub>>, GRefTRefU<Base,Sub>>(false)); Eval("Test202", UnboxUToT<IPlusT<IMinusT<Base>>, GRefTRefU<Base,Sub>>(false)); Eval("Test203", UnboxUToT<IPlusTMinusU<IPlusT<Sub>,IPlusT<Base>>, GRefTRefU<Base,Sub>>(false)); Eval("Test204", UnboxUToT<IPlusT<IPlusT<Sub[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test205", UnboxUToT<IPlusT<IMinusT<Base[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test206", UnboxUToT<IPlusTMinusU<IPlusT<Sub[]>,IPlusT<Base[]>>, GRefTRefU<Base[],Sub[]>>(false)); Eval("Test207", UnboxUToT<IPlusT<IPlusT<GSubT<int>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test208", UnboxUToT<IPlusT<IMinusT<GBase<string>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test209", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>>,IPlusT<GBase<string>>>, GRefTRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test210", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test211", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test212", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>,IPlusT<GBase<string>[]>>, GRefTRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test301", UnboxUToT<IPlusT<IPlusT<Sub[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test302", UnboxUToT<IPlusT<IMinusT<Base[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test303", UnboxUToT<IPlusTMinusU<IPlusT<Sub[]>,IPlusT<Base[]>>, GRefTArrRefUArr<Base,Sub>>(false)); Eval("Test304", UnboxUToT<IPlusT<IPlusT<Sub[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test305", UnboxUToT<IPlusT<IMinusT<Base[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test306", UnboxUToT<IPlusTMinusU<IPlusT<Sub[][]>,IPlusT<Base[][]>>, GRefTArrRefUArr<Base[],Sub[]>>(false)); Eval("Test307", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test308", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test309", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>,IPlusT<GBase<string>[]>>, GRefTArrRefUArr<GBase<int>,GSubT<string>>>(false)); Eval("Test310", UnboxUToT<IPlusT<IPlusT<GSubT<int>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test311", UnboxUToT<IPlusT<IMinusT<GBase<string>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test312", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[][]>,IPlusT<GBase<string>[][]>>, GRefTArrRefUArr<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test401", UnboxUToT<IPlusT<IPlusT<Sub>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test402", UnboxUToT<IPlusT<IMinusT<Base>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test403", UnboxUToT<IPlusTMinusU<IPlusT<Sub>[],IPlusT<Base>[]>, GArrRefTArrRefU<Base,Sub>>(false)); Eval("Test404", UnboxUToT<IPlusT<IPlusT<Sub[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test405", UnboxUToT<IPlusT<IMinusT<Base[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test406", UnboxUToT<IPlusTMinusU<IPlusT<Sub[,]>[],IPlusT<Base[,]>[]>, GArrRefTArrRefU<Base[,],Sub[,]>>(false)); Eval("Test407", UnboxUToT<IPlusT<IPlusT<GSubT<int>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test408", UnboxUToT<IPlusT<IMinusT<GBase<string>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test409", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>>[],IPlusT<GBase<string>>[]>, GArrRefTArrRefU<GBase<int>,GSubT<string>>>(false)); Eval("Test410", UnboxUToT<IPlusT<IPlusT<GSubT<int>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test411", UnboxUToT<IPlusT<IMinusT<GBase<string>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); Eval("Test412", UnboxUToT<IPlusTMinusU<IPlusT<GSubT<int>[]>[],IPlusT<GBase<string>[]>[]>, GArrRefTArrRefU<GBase<int>[],GSubT<string>[]>>(false)); if( iErrorCount > 0 ) { Console.WriteLine( "Total test cases: " + iTestCount + " Failed test cases: " + iErrorCount ); return false; } else { Console.WriteLine( "Total test cases: " + iTestCount ); return true; } } public static int Main(String [] args) { if( RunTests() ) { iExitCode = 100; Console.WriteLine( "All test cases passed" ); } else { iExitCode = 101; Console.WriteLine( "Test failed" ); } return iExitCode; } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/mono/mono/tests/process2.cs
using System; using System.Diagnostics; using System.Threading; class Modules { static void Run() { Process proc = new Process(); bool ret; proc.StartInfo.FileName="wibble-redir"; proc.StartInfo.Arguments="arg1 arg2\targ3 \"arg4a arg4b\""; proc.StartInfo.UseShellExecute=false; proc.StartInfo.RedirectStandardInput=true; ret=proc.Start(); Console.WriteLine("Start returns " + ret); Console.WriteLine("Process is " + proc.ToString()); Console.WriteLine("Pid is " + proc.Id); Console.WriteLine("Handle is " + proc.Handle); Console.WriteLine("HandleCount is " + proc.HandleCount); Console.WriteLine("Writing [foo bar]"); proc.StandardInput.WriteLine("foo bar"); System.Threading.Thread.Sleep(1000); Console.WriteLine("Writing [wibble wobble]"); proc.StandardInput.WriteLine("wibble wobble"); System.Threading.Thread.Sleep(1000); Console.WriteLine("Closing stdin"); proc.StandardInput.Close(); Console.WriteLine("Waiting for exit..."); proc.WaitForExit(); Console.WriteLine("Wait returned"); Console.WriteLine("Exit code is " + proc.ExitCode); Console.WriteLine("Process started at " + proc.StartTime); Console.WriteLine("Process ended at " + proc.ExitTime); } static void Main() { Run(); } }
using System; using System.Diagnostics; using System.Threading; class Modules { static void Run() { Process proc = new Process(); bool ret; proc.StartInfo.FileName="wibble-redir"; proc.StartInfo.Arguments="arg1 arg2\targ3 \"arg4a arg4b\""; proc.StartInfo.UseShellExecute=false; proc.StartInfo.RedirectStandardInput=true; ret=proc.Start(); Console.WriteLine("Start returns " + ret); Console.WriteLine("Process is " + proc.ToString()); Console.WriteLine("Pid is " + proc.Id); Console.WriteLine("Handle is " + proc.Handle); Console.WriteLine("HandleCount is " + proc.HandleCount); Console.WriteLine("Writing [foo bar]"); proc.StandardInput.WriteLine("foo bar"); System.Threading.Thread.Sleep(1000); Console.WriteLine("Writing [wibble wobble]"); proc.StandardInput.WriteLine("wibble wobble"); System.Threading.Thread.Sleep(1000); Console.WriteLine("Closing stdin"); proc.StandardInput.Close(); Console.WriteLine("Waiting for exit..."); proc.WaitForExit(); Console.WriteLine("Wait returned"); Console.WriteLine("Exit code is " + proc.ExitCode); Console.WriteLine("Process started at " + proc.StartTime); Console.WriteLine("Process ended at " + proc.ExitTime); } static void Main() { Run(); } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Fakes/IFakeService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { public interface IFakeService { } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { public interface IFakeService { } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/LeadingZeroCount.Vector64.SByte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void LeadingZeroCount_Vector64_SByte() { var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<SByte> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte testClass) { var result = AdvSimd.LeadingZeroCount(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static Vector64<SByte> _clsVar1; private Vector64<SByte> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, new SByte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.LeadingZeroCount( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LeadingZeroCount), new Type[] { typeof(Vector64<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LeadingZeroCount), new Type[] { typeof(Vector64<SByte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.LeadingZeroCount( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr); var result = AdvSimd.LeadingZeroCount(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)); var result = AdvSimd.LeadingZeroCount(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); var result = AdvSimd.LeadingZeroCount(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.LeadingZeroCount(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.LeadingZeroCount(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<SByte> op1, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.CountLeadingZeroBits(firstOp[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.LeadingZeroCount)}<SByte>(Vector64<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void LeadingZeroCount_Vector64_SByte() { var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<SByte> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte testClass) { var result = AdvSimd.LeadingZeroCount(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static Vector64<SByte> _clsVar1; private Vector64<SByte> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, new SByte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.LeadingZeroCount( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LeadingZeroCount), new Type[] { typeof(Vector64<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LeadingZeroCount), new Type[] { typeof(Vector64<SByte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.LeadingZeroCount( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr); var result = AdvSimd.LeadingZeroCount(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)); var result = AdvSimd.LeadingZeroCount(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); var result = AdvSimd.LeadingZeroCount(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__LeadingZeroCount_Vector64_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.LeadingZeroCount(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) { var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.LeadingZeroCount(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.LeadingZeroCount( AdvSimd.LoadVector64((SByte*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<SByte> op1, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.CountLeadingZeroBits(firstOp[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.LeadingZeroCount)}<SByte>(Vector64<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/mono/mono/tests/jit-int.cs
using System; public class TestJit { public static int test_short () { int max = 32767; int min = -32768; int t1 = 0xffeedd; short s1 = (short)t1; int t2 = s1; if ((uint)t2 != 0xffffeedd) return 1; Console.WriteLine (t2.ToString ("X")); if (Int16.Parse((min).ToString()) != -32768) return 1; if (Int16.Parse((max).ToString()) != 32767) return 1; return 0; } public static int test_call (int a, int b) { return a+b; } public static int test_shift () { int a = 9, b = 1; if ((a << 1) != 18) return 1; if ((a << b) != 18) return 1; if ((a >> 1) != 4) return 1; if ((a >> b) != 4) return 1; a = -9; if ((a >> b) != -5) return 1; return 0; } public static int test_alu () { int a = 9, b = 6; if ((a + b) != 15) return 1; if ((a - b) != 3) return 1; if ((a & 8) != 8) return 1; if ((a | 2) != 11) return 1; if ((a * b) != 54) return 1; if ((a / 4) != 2) return 1; if ((a % 4) != 1) return 1; if (-a != -9) return 1; b = -1; if (~b != 0) return 1; return 0; } public static int test_branch () { int a = 5, b = 5, t; if (a == b) t = 1; else t = 0; if (t != 1) return 1; if (a != b) t = 0; else t = 1; if (t != 1) return 1; if (a >= b) t = 1; else t = 0; if (t != 1) return 1; if (a > b) t = 0; else t = 1; if (t != 1) return 1; if (a <= b) t = 1; else t = 0; if (t != 1) return 1; if (a < b) t = 0; else t = 1; if (t != 1) return 1; return 0; } public static int Main() { int num = 0; num++; if (test_short () != 0) return num; num++; if (test_call (3, 5) != 8) return num; num++; if (test_branch () != 0) return num; num++; if (test_alu () != 0) return num; num++; if (test_shift () != 0) return num; num++; return 0; } }
using System; public class TestJit { public static int test_short () { int max = 32767; int min = -32768; int t1 = 0xffeedd; short s1 = (short)t1; int t2 = s1; if ((uint)t2 != 0xffffeedd) return 1; Console.WriteLine (t2.ToString ("X")); if (Int16.Parse((min).ToString()) != -32768) return 1; if (Int16.Parse((max).ToString()) != 32767) return 1; return 0; } public static int test_call (int a, int b) { return a+b; } public static int test_shift () { int a = 9, b = 1; if ((a << 1) != 18) return 1; if ((a << b) != 18) return 1; if ((a >> 1) != 4) return 1; if ((a >> b) != 4) return 1; a = -9; if ((a >> b) != -5) return 1; return 0; } public static int test_alu () { int a = 9, b = 6; if ((a + b) != 15) return 1; if ((a - b) != 3) return 1; if ((a & 8) != 8) return 1; if ((a | 2) != 11) return 1; if ((a * b) != 54) return 1; if ((a / 4) != 2) return 1; if ((a % 4) != 1) return 1; if (-a != -9) return 1; b = -1; if (~b != 0) return 1; return 0; } public static int test_branch () { int a = 5, b = 5, t; if (a == b) t = 1; else t = 0; if (t != 1) return 1; if (a != b) t = 0; else t = 1; if (t != 1) return 1; if (a >= b) t = 1; else t = 0; if (t != 1) return 1; if (a > b) t = 0; else t = 1; if (t != 1) return 1; if (a <= b) t = 1; else t = 0; if (t != 1) return 1; if (a < b) t = 0; else t = 1; if (t != 1) return 1; return 0; } public static int Main() { int num = 0; num++; if (test_short () != 0) return num; num++; if (test_call (3, 5) != 8) return num; num++; if (test_branch () != 0) return num; num++; if (test_alu () != 0) return num; num++; if (test_shift () != 0) return num; num++; return 0; } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Threading.Tasks.Parallel/tests/ParallelFor.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Threading.Tasks.Tests { public static class ParallelForUnitTests { [Theory] [InlineData(API.For64, StartIndexBase.Int32, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 1, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 1, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] public static void ParrallelFor(API api, StartIndexBase startIndexBase, int count, WithParallelOption parallelOption, ActionWithState stateOption, ActionWithLocal localOption) { var parameters = new TestParameters(api, startIndexBase) { Count = count, ParallelOption = parallelOption, StateOption = stateOption, LocalOption = localOption }; var test = new ParallelForTest(parameters); test.RealRun(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Threading.Tasks.Tests { public static class ParallelForUnitTests { [Theory] [InlineData(API.For64, StartIndexBase.Int32, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 1, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 1, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For64, StartIndexBase.Int32, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For64, StartIndexBase.Int32, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.For, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.For, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnArray, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.ForeachOnList, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 0, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.None, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 10, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 1, WithParallelOption.None, ActionWithState.None, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 1, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 2, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] [InlineData(API.Foreach, StartIndexBase.Zero, 97, WithParallelOption.None, ActionWithState.None, ActionWithLocal.HasFinally)] [InlineData(API.Foreach, StartIndexBase.Zero, 97, WithParallelOption.WithDOP, ActionWithState.Stop, ActionWithLocal.None)] public static void ParrallelFor(API api, StartIndexBase startIndexBase, int count, WithParallelOption parallelOption, ActionWithState stateOption, ActionWithLocal localOption) { var parameters = new TestParameters(api, startIndexBase) { Count = count, ParallelOption = parallelOption, StateOption = stateOption, LocalOption = localOption }; var test = new ParallelForTest(parameters); test.RealRun(); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/Intrinsics/MathFloorSingle.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; namespace MathFloorSingleTest { class Program { public const int Pass = 100; public const int Fail = 0; public const float constantValue = 0.0f; public static float staticValue = 1.1f; public static float[] staticValueArray = new float[] { 2.2f, 3.3f, 4.4f }; public float instanceValue = 5.5f; public float[] instanceValueArray = new float[] { 6.6f, 7.7f, 8.8f }; unsafe static int Main(string[] args) { float localValue = 9.9f; var program = new Program(); if (MathF.Floor(constantValue) != 0.0f) { Console.WriteLine("MathF.Floor of a constant value failed"); return Fail; } if (MathF.Floor(staticValue) != 1.0f) { Console.WriteLine("MathF.Floor of a static value failed"); return Fail; } fixed (float* pStaticValue = &staticValue) { if (MathF.Floor(*pStaticValue) != 1.0f) { Console.WriteLine("MathF.Floor of an addressed static value failed"); return Fail; } } if (MathF.Floor(staticValueArray[0]) != 2.0f) { Console.WriteLine("MathF.Floor of a static value array (index 0) failed"); return Fail; } if (MathF.Floor(staticValueArray[1]) != 3.0f) { Console.WriteLine("MathF.Floor of a static value array (index 1) failed"); return Fail; } if (MathF.Floor(staticValueArray[2]) != 4.0f) { Console.WriteLine("MathF.Floor of a static value array (index 2) failed"); return Fail; } fixed (float* pStaticValueArray = &staticValueArray[0]) { if (MathF.Floor(pStaticValueArray[0]) != 2.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 0) failed"); return Fail; } if (MathF.Floor(pStaticValueArray[1]) != 3.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 1) failed"); return Fail; } if (MathF.Floor(pStaticValueArray[2]) != 4.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 2) failed"); return Fail; } } if (MathF.Floor(program.instanceValue) != 5.0f) { Console.WriteLine("MathF.Floor of an instance value failed"); return Fail; } fixed (float* pInstanceValue = &program.instanceValue) { if (MathF.Floor(*pInstanceValue) != 5.0f) { Console.WriteLine("MathF.Floor of an addressed instance value failed"); return Fail; } } if (MathF.Floor(program.instanceValueArray[0]) != 6.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 0) failed"); return Fail; } if (MathF.Floor(program.instanceValueArray[1]) != 7.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 1) failed"); return Fail; } if (MathF.Floor(program.instanceValueArray[2]) != 8.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 2) failed"); return Fail; } fixed (float* pInstanceValueArray = &program.instanceValueArray[0]) { if (MathF.Floor(pInstanceValueArray[0]) != 6.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 0) failed"); return Fail; } if (MathF.Floor(pInstanceValueArray[1]) != 7.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 1) failed"); return Fail; } if (MathF.Floor(pInstanceValueArray[2]) != 8.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 2) failed"); return Fail; } } if (MathF.Floor(localValue) != 9.0f) { Console.WriteLine("MathF.Floor of a local value failed"); return Fail; } float* pLocalValue = &localValue; if (MathF.Floor(*pLocalValue) != 9.0f) { Console.WriteLine("MathF.Floor of an addressed local value failed"); return Fail; } return Pass; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; namespace MathFloorSingleTest { class Program { public const int Pass = 100; public const int Fail = 0; public const float constantValue = 0.0f; public static float staticValue = 1.1f; public static float[] staticValueArray = new float[] { 2.2f, 3.3f, 4.4f }; public float instanceValue = 5.5f; public float[] instanceValueArray = new float[] { 6.6f, 7.7f, 8.8f }; unsafe static int Main(string[] args) { float localValue = 9.9f; var program = new Program(); if (MathF.Floor(constantValue) != 0.0f) { Console.WriteLine("MathF.Floor of a constant value failed"); return Fail; } if (MathF.Floor(staticValue) != 1.0f) { Console.WriteLine("MathF.Floor of a static value failed"); return Fail; } fixed (float* pStaticValue = &staticValue) { if (MathF.Floor(*pStaticValue) != 1.0f) { Console.WriteLine("MathF.Floor of an addressed static value failed"); return Fail; } } if (MathF.Floor(staticValueArray[0]) != 2.0f) { Console.WriteLine("MathF.Floor of a static value array (index 0) failed"); return Fail; } if (MathF.Floor(staticValueArray[1]) != 3.0f) { Console.WriteLine("MathF.Floor of a static value array (index 1) failed"); return Fail; } if (MathF.Floor(staticValueArray[2]) != 4.0f) { Console.WriteLine("MathF.Floor of a static value array (index 2) failed"); return Fail; } fixed (float* pStaticValueArray = &staticValueArray[0]) { if (MathF.Floor(pStaticValueArray[0]) != 2.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 0) failed"); return Fail; } if (MathF.Floor(pStaticValueArray[1]) != 3.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 1) failed"); return Fail; } if (MathF.Floor(pStaticValueArray[2]) != 4.0f) { Console.WriteLine("MathF.Floor of a addressed static value array (index 2) failed"); return Fail; } } if (MathF.Floor(program.instanceValue) != 5.0f) { Console.WriteLine("MathF.Floor of an instance value failed"); return Fail; } fixed (float* pInstanceValue = &program.instanceValue) { if (MathF.Floor(*pInstanceValue) != 5.0f) { Console.WriteLine("MathF.Floor of an addressed instance value failed"); return Fail; } } if (MathF.Floor(program.instanceValueArray[0]) != 6.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 0) failed"); return Fail; } if (MathF.Floor(program.instanceValueArray[1]) != 7.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 1) failed"); return Fail; } if (MathF.Floor(program.instanceValueArray[2]) != 8.0f) { Console.WriteLine("MathF.Floor of an instance value array (index 2) failed"); return Fail; } fixed (float* pInstanceValueArray = &program.instanceValueArray[0]) { if (MathF.Floor(pInstanceValueArray[0]) != 6.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 0) failed"); return Fail; } if (MathF.Floor(pInstanceValueArray[1]) != 7.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 1) failed"); return Fail; } if (MathF.Floor(pInstanceValueArray[2]) != 8.0f) { Console.WriteLine("MathF.Floor of a addressed instance value array (index 2) failed"); return Fail; } } if (MathF.Floor(localValue) != 9.0f) { Console.WriteLine("MathF.Floor of a local value failed"); return Fail; } float* pLocalValue = &localValue; if (MathF.Floor(*pLocalValue) != 9.0f) { Console.WriteLine("MathF.Floor of an addressed local value failed"); return Fail; } return Pass; } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/ReciprocalSquareRootEstimateScalar.Vector64.Double.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ReciprocalSquareRootEstimateScalar_Vector64_Double() { var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Double> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double testClass) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double testClass) { fixed (Vector64<Double>* pFld1 = &_fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector64<Double> _clsVar1; private Vector64<Double> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); } public SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } _dataTable = new DataTable(_data1, new Double[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar), new Type[] { typeof(Vector64<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar), new Type[] { typeof(Vector64<Double>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Double>* pClsVar1 = &_clsVar1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); fixed (Vector64<Double>* pFld1 = &test._fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Double>* pFld1 = &_fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Double>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Double>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != 0x4001d00000000000) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(result[i]) != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar)}<Double>(Vector64<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ReciprocalSquareRootEstimateScalar_Vector64_Double() { var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Double> _fld1; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); return testStruct; } public void RunStructFldScenario(SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double testClass) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double testClass) { fixed (Vector64<Double>* pFld1 = &_fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector64<Double> _clsVar1; private Vector64<Double> _fld1; private DataTable _dataTable; static SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); } public SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = BitConverter.Int64BitsToDouble(0x3fc9db3dab555868); } _dataTable = new DataTable(_data1, new Double[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar), new Type[] { typeof(Vector64<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar), new Type[] { typeof(Vector64<Double>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Double>* pClsVar1 = &_clsVar1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pClsVar1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Double>>(_dataTable.inArray1Ptr); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Double*)(_dataTable.inArray1Ptr)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleUnaryOpTest__ReciprocalSquareRootEstimateScalar_Vector64_Double(); fixed (Vector64<Double>* pFld1 = &test._fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Double>* pFld1 = &_fld1) { var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(pFld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar( AdvSimd.LoadVector64((Double*)(&test._fld1)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Double>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Double>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != 0x4001d00000000000) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(result[i]) != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ReciprocalSquareRootEstimateScalar)}<Double>(Vector64<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Private.Xml/tests/XmlReaderLib/TCMoveToFirstAttribute.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using OLEDB.Test.ModuleCore; namespace System.Xml.Tests { public partial class TCMoveToFirstAttribute : TCXMLReaderBaseGeneral { // Type is System.Xml.Tests.TCMoveToFirstAttribute // Test Case public override void AddChildren() { // for function MoveToFirstAttribute1 { this.AddChild(new CVariation(MoveToFirstAttribute1) { Attribute = new Variation("MoveToFirstAttribute() When AttributeCount=0, <EMPTY1/> ") { Pri = 0 } }); } // for function MoveToFirstAttribute2 { this.AddChild(new CVariation(MoveToFirstAttribute2) { Attribute = new Variation("MoveToFirstAttribute() When AttributeCount=0, <NONEMPTY1>ABCDE</NONEMPTY1> ") }); } // for function MoveToFirstAttribute3 { this.AddChild(new CVariation(MoveToFirstAttribute3) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=0, with namespace") }); } // for function MoveToFirstAttribute4 { this.AddChild(new CVariation(MoveToFirstAttribute4) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=0, without namespace") }); } // for function MoveToFirstAttribute5 { this.AddChild(new CVariation(MoveToFirstAttribute5) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=middle, with namespace") }); } // for function MoveToFirstAttribute6 { this.AddChild(new CVariation(MoveToFirstAttribute6) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=middle, without namespace") }); } // for function MoveToFirstAttribute7 { this.AddChild(new CVariation(MoveToFirstAttribute7) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=end, with namespace") }); } // for function MoveToFirstAttribute8 { this.AddChild(new CVariation(MoveToFirstAttribute8) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=end, without namespace") }); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using OLEDB.Test.ModuleCore; namespace System.Xml.Tests { public partial class TCMoveToFirstAttribute : TCXMLReaderBaseGeneral { // Type is System.Xml.Tests.TCMoveToFirstAttribute // Test Case public override void AddChildren() { // for function MoveToFirstAttribute1 { this.AddChild(new CVariation(MoveToFirstAttribute1) { Attribute = new Variation("MoveToFirstAttribute() When AttributeCount=0, <EMPTY1/> ") { Pri = 0 } }); } // for function MoveToFirstAttribute2 { this.AddChild(new CVariation(MoveToFirstAttribute2) { Attribute = new Variation("MoveToFirstAttribute() When AttributeCount=0, <NONEMPTY1>ABCDE</NONEMPTY1> ") }); } // for function MoveToFirstAttribute3 { this.AddChild(new CVariation(MoveToFirstAttribute3) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=0, with namespace") }); } // for function MoveToFirstAttribute4 { this.AddChild(new CVariation(MoveToFirstAttribute4) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=0, without namespace") }); } // for function MoveToFirstAttribute5 { this.AddChild(new CVariation(MoveToFirstAttribute5) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=middle, with namespace") }); } // for function MoveToFirstAttribute6 { this.AddChild(new CVariation(MoveToFirstAttribute6) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=middle, without namespace") }); } // for function MoveToFirstAttribute7 { this.AddChild(new CVariation(MoveToFirstAttribute7) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=end, with namespace") }); } // for function MoveToFirstAttribute8 { this.AddChild(new CVariation(MoveToFirstAttribute8) { Attribute = new Variation("MoveToFirstAttribute() When iOrdinal=end, without namespace") }); } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ToScalarInt16() { var test = new VectorToScalar__ToScalarInt16(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorToScalar__ToScalarInt16 { private static readonly int LargestVectorSize = 32; private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Int16[] values = new Int16[ElementCount]; for (int i = 0; i < ElementCount; i++) { values[i] = TestLibrary.Generator.GetInt16(); } Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); Int16 result = value.ToScalar(); ValidateResult(result, values); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Int16[] values = new Int16[ElementCount]; for (int i = 0; i < ElementCount; i++) { values[i] = TestLibrary.Generator.GetInt16(); } Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); object result = typeof(Vector256) .GetMethod(nameof(Vector256.ToScalar)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Int16)(result), values); } private void ValidateResult(Int16 result, Int16[] values, [CallerMemberName] string method = "") { if (result != values[0]) { TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.ToScalar(): {method} failed:"); TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})"); TestLibrary.TestFramework.LogInformation($" result: {result}"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ToScalarInt16() { var test = new VectorToScalar__ToScalarInt16(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorToScalar__ToScalarInt16 { private static readonly int LargestVectorSize = 32; private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Int16[] values = new Int16[ElementCount]; for (int i = 0; i < ElementCount; i++) { values[i] = TestLibrary.Generator.GetInt16(); } Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); Int16 result = value.ToScalar(); ValidateResult(result, values); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Int16[] values = new Int16[ElementCount]; for (int i = 0; i < ElementCount; i++) { values[i] = TestLibrary.Generator.GetInt16(); } Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); object result = typeof(Vector256) .GetMethod(nameof(Vector256.ToScalar)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Int16)(result), values); } private void ValidateResult(Int16 result, Int16[] values, [CallerMemberName] string method = "") { if (result != values[0]) { TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.ToScalar(): {method} failed:"); TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})"); TestLibrary.TestFramework.LogInformation($" result: {result}"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Memory/tests/Span/AsSpan.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.SpanTests { public static partial class SpanTests { [Fact] public static void IntArrayAsSpan() { int[] a = { 91, 92, -93, 94 }; Span<int> spanInt = a.AsSpan(); spanInt.Validate(91, 92, -93, 94); } [Fact] public static void LongArrayAsSpan() { long[] b = { 91, -92, 93, 94, -95 }; Span<long> spanLong = b.AsSpan(); spanLong.Validate(91, -92, 93, 94, -95); } [Fact] public static void ObjectArrayAsSpan() { object o1 = new object(); object o2 = new object(); object[] c = { o1, o2 }; Span<object> spanObject = c.AsSpan(); spanObject.ValidateReferenceType(o1, o2); } [Fact] public static void NullArrayAsSpan() { int[] a = null; Span<int> span = a.AsSpan(); span.Validate(); Assert.True(span == default); } [Fact] public static void EmptyArrayAsSpan() { int[] empty = Array.Empty<int>(); Span<int> span = empty.AsSpan(); span.ValidateNonNullEmpty(); } [Fact] public static void IntArraySegmentAsSpan() { int[] a = { 91, 92, -93, 94 }; ArraySegment<int> segmentInt = new ArraySegment<int>(a, 1, 2); Span<int> spanInt = segmentInt.AsSpan(); spanInt.Validate(92, -93); } [Fact] public static void LongArraySegmentAsSpan() { long[] b = { 91, -92, 93, 94, -95 }; ArraySegment<long> segmentLong = new ArraySegment<long>(b, 1, 3); Span<long> spanLong = segmentLong.AsSpan(); spanLong.Validate(-92, 93, 94); } [Fact] public static void ObjectArraySegmentAsSpan() { object o1 = new object(); object o2 = new object(); object o3 = new object(); object o4 = new object(); object[] c = { o1, o2, o3, o4 }; ArraySegment<object> segmentObject = new ArraySegment<object>(c, 1, 2); Span<object> spanObject = segmentObject.AsSpan(); spanObject.ValidateReferenceType(o2, o3); } [Fact] public static void ZeroLengthArraySegmentAsSpan() { int[] empty = Array.Empty<int>(); ArraySegment<int> segmentEmpty = new ArraySegment<int>(empty); Span<int> spanEmpty = segmentEmpty.AsSpan(); spanEmpty.ValidateNonNullEmpty(); int[] a = { 91, 92, -93, 94 }; ArraySegment<int> segmentInt = new ArraySegment<int>(a, 0, 0); Span<int> spanInt = segmentInt.AsSpan(); spanInt.ValidateNonNullEmpty(); } [Fact] public static void CovariantAsSpanNotSupported() { object[] a = new string[10]; Assert.Throws<ArrayTypeMismatchException>(() => a.AsSpan()); Assert.Throws<ArrayTypeMismatchException>(() => a.AsSpan(0, a.Length)); } [Fact] public static void GuidArrayAsSpanWithStartAndLength() { var arr = new Guid[20]; Span<Guid> slice = arr.AsSpan(2, 2); Guid guid = Guid.NewGuid(); slice[1] = guid; Assert.Equal(guid, arr[3]); } [Theory] [InlineData(0, 0)] [InlineData(3, 0)] [InlineData(3, 1)] [InlineData(3, 2)] [InlineData(3, 3)] [InlineData(10, 0)] [InlineData(10, 3)] [InlineData(10, 10)] public static void ArrayAsSpanWithStart(int length, int start) { int[] a = new int[length]; Span<int> s = a.AsSpan(start); Assert.Equal(length - start, s.Length); if (start != length) { s[0] = 42; Assert.Equal(42, a[start]); } } [Theory] [InlineData(0, 0)] [InlineData(3, 0)] [InlineData(3, 1)] [InlineData(3, 2)] [InlineData(3, 3)] [InlineData(10, 0)] [InlineData(10, 3)] [InlineData(10, 10)] public static void ArraySegmentAsSpanWithStart(int length, int start) { const int segmentOffset = 5; int[] a = new int[length + segmentOffset]; ArraySegment<int> segment = new ArraySegment<int>(a, 5, length); Span<int> s = segment.AsSpan(start); Assert.Equal(length - start, s.Length); if (s.Length != 0) { s[0] = 42; Assert.Equal(42, a[segmentOffset + start]); } } [Theory] [InlineData(0, 0, 0)] [InlineData(3, 0, 3)] [InlineData(3, 1, 2)] [InlineData(3, 2, 1)] [InlineData(3, 3, 0)] [InlineData(10, 0, 5)] [InlineData(10, 3, 2)] public static void ArrayAsSpanWithStartAndLength(int length, int start, int subLength) { int[] a = new int[length]; Span<int> s = a.AsSpan(start, subLength); Assert.Equal(subLength, s.Length); if (subLength != 0) { s[0] = 42; Assert.Equal(42, a[start]); } } [Theory] [InlineData(0, 0, 0)] [InlineData(3, 0, 3)] [InlineData(3, 1, 2)] [InlineData(3, 2, 1)] [InlineData(3, 3, 0)] [InlineData(10, 0, 5)] [InlineData(10, 3, 2)] public static void ArraySegmentAsSpanWithStartAndLength(int length, int start, int subLength) { const int segmentOffset = 5; int[] a = new int[length + segmentOffset]; ArraySegment<int> segment = new ArraySegment<int>(a, segmentOffset, length); Span<int> s = segment.AsSpan(start, subLength); Assert.Equal(subLength, s.Length); if (subLength != 0) { s[0] = 42; Assert.Equal(42, a[segmentOffset + start]); } } [Theory] [InlineData(0, -1)] [InlineData(0, 1)] [InlineData(5, 6)] public static void ArrayAsSpanWithStartNegative(int length, int start) { int[] a = new int[length]; Assert.Throws<ArgumentOutOfRangeException>(() => a.AsSpan(start)); } [Theory] [InlineData(0, -1, 0)] [InlineData(0, 1, 0)] [InlineData(0, 0, -1)] [InlineData(0, 0, 1)] [InlineData(5, 6, 0)] [InlineData(5, 3, 3)] public static void ArrayAsSpanWithStartAndLengthNegative(int length, int start, int subLength) { int[] a = new int[length]; Assert.Throws<ArgumentOutOfRangeException>(() => a.AsSpan(start, subLength)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.SpanTests { public static partial class SpanTests { [Fact] public static void IntArrayAsSpan() { int[] a = { 91, 92, -93, 94 }; Span<int> spanInt = a.AsSpan(); spanInt.Validate(91, 92, -93, 94); } [Fact] public static void LongArrayAsSpan() { long[] b = { 91, -92, 93, 94, -95 }; Span<long> spanLong = b.AsSpan(); spanLong.Validate(91, -92, 93, 94, -95); } [Fact] public static void ObjectArrayAsSpan() { object o1 = new object(); object o2 = new object(); object[] c = { o1, o2 }; Span<object> spanObject = c.AsSpan(); spanObject.ValidateReferenceType(o1, o2); } [Fact] public static void NullArrayAsSpan() { int[] a = null; Span<int> span = a.AsSpan(); span.Validate(); Assert.True(span == default); } [Fact] public static void EmptyArrayAsSpan() { int[] empty = Array.Empty<int>(); Span<int> span = empty.AsSpan(); span.ValidateNonNullEmpty(); } [Fact] public static void IntArraySegmentAsSpan() { int[] a = { 91, 92, -93, 94 }; ArraySegment<int> segmentInt = new ArraySegment<int>(a, 1, 2); Span<int> spanInt = segmentInt.AsSpan(); spanInt.Validate(92, -93); } [Fact] public static void LongArraySegmentAsSpan() { long[] b = { 91, -92, 93, 94, -95 }; ArraySegment<long> segmentLong = new ArraySegment<long>(b, 1, 3); Span<long> spanLong = segmentLong.AsSpan(); spanLong.Validate(-92, 93, 94); } [Fact] public static void ObjectArraySegmentAsSpan() { object o1 = new object(); object o2 = new object(); object o3 = new object(); object o4 = new object(); object[] c = { o1, o2, o3, o4 }; ArraySegment<object> segmentObject = new ArraySegment<object>(c, 1, 2); Span<object> spanObject = segmentObject.AsSpan(); spanObject.ValidateReferenceType(o2, o3); } [Fact] public static void ZeroLengthArraySegmentAsSpan() { int[] empty = Array.Empty<int>(); ArraySegment<int> segmentEmpty = new ArraySegment<int>(empty); Span<int> spanEmpty = segmentEmpty.AsSpan(); spanEmpty.ValidateNonNullEmpty(); int[] a = { 91, 92, -93, 94 }; ArraySegment<int> segmentInt = new ArraySegment<int>(a, 0, 0); Span<int> spanInt = segmentInt.AsSpan(); spanInt.ValidateNonNullEmpty(); } [Fact] public static void CovariantAsSpanNotSupported() { object[] a = new string[10]; Assert.Throws<ArrayTypeMismatchException>(() => a.AsSpan()); Assert.Throws<ArrayTypeMismatchException>(() => a.AsSpan(0, a.Length)); } [Fact] public static void GuidArrayAsSpanWithStartAndLength() { var arr = new Guid[20]; Span<Guid> slice = arr.AsSpan(2, 2); Guid guid = Guid.NewGuid(); slice[1] = guid; Assert.Equal(guid, arr[3]); } [Theory] [InlineData(0, 0)] [InlineData(3, 0)] [InlineData(3, 1)] [InlineData(3, 2)] [InlineData(3, 3)] [InlineData(10, 0)] [InlineData(10, 3)] [InlineData(10, 10)] public static void ArrayAsSpanWithStart(int length, int start) { int[] a = new int[length]; Span<int> s = a.AsSpan(start); Assert.Equal(length - start, s.Length); if (start != length) { s[0] = 42; Assert.Equal(42, a[start]); } } [Theory] [InlineData(0, 0)] [InlineData(3, 0)] [InlineData(3, 1)] [InlineData(3, 2)] [InlineData(3, 3)] [InlineData(10, 0)] [InlineData(10, 3)] [InlineData(10, 10)] public static void ArraySegmentAsSpanWithStart(int length, int start) { const int segmentOffset = 5; int[] a = new int[length + segmentOffset]; ArraySegment<int> segment = new ArraySegment<int>(a, 5, length); Span<int> s = segment.AsSpan(start); Assert.Equal(length - start, s.Length); if (s.Length != 0) { s[0] = 42; Assert.Equal(42, a[segmentOffset + start]); } } [Theory] [InlineData(0, 0, 0)] [InlineData(3, 0, 3)] [InlineData(3, 1, 2)] [InlineData(3, 2, 1)] [InlineData(3, 3, 0)] [InlineData(10, 0, 5)] [InlineData(10, 3, 2)] public static void ArrayAsSpanWithStartAndLength(int length, int start, int subLength) { int[] a = new int[length]; Span<int> s = a.AsSpan(start, subLength); Assert.Equal(subLength, s.Length); if (subLength != 0) { s[0] = 42; Assert.Equal(42, a[start]); } } [Theory] [InlineData(0, 0, 0)] [InlineData(3, 0, 3)] [InlineData(3, 1, 2)] [InlineData(3, 2, 1)] [InlineData(3, 3, 0)] [InlineData(10, 0, 5)] [InlineData(10, 3, 2)] public static void ArraySegmentAsSpanWithStartAndLength(int length, int start, int subLength) { const int segmentOffset = 5; int[] a = new int[length + segmentOffset]; ArraySegment<int> segment = new ArraySegment<int>(a, segmentOffset, length); Span<int> s = segment.AsSpan(start, subLength); Assert.Equal(subLength, s.Length); if (subLength != 0) { s[0] = 42; Assert.Equal(42, a[segmentOffset + start]); } } [Theory] [InlineData(0, -1)] [InlineData(0, 1)] [InlineData(5, 6)] public static void ArrayAsSpanWithStartNegative(int length, int start) { int[] a = new int[length]; Assert.Throws<ArgumentOutOfRangeException>(() => a.AsSpan(start)); } [Theory] [InlineData(0, -1, 0)] [InlineData(0, 1, 0)] [InlineData(0, 0, -1)] [InlineData(0, 0, 1)] [InlineData(5, 6, 0)] [InlineData(5, 3, 3)] public static void ArrayAsSpanWithStartAndLengthNegative(int length, int start, int subLength) { int[] a = new int[length]; Assert.Throws<ArgumentOutOfRangeException>(() => a.AsSpan(start, subLength)); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.TryGetProperty.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers; using System.Diagnostics; namespace System.Text.Json { public sealed partial class JsonDocument { internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<char> propertyName, out JsonElement value) { CheckNotDisposed(); DbRow row = _parsedData.Get(index); CheckExpectedType(JsonTokenType.StartObject, row.TokenType); // Only one row means it was EndObject. if (row.NumberOfRows == 1) { value = default; return false; } int maxBytes = JsonReaderHelper.s_utf8Encoding.GetMaxByteCount(propertyName.Length); int startIndex = index + DbRow.Size; int endIndex = checked(row.NumberOfRows * DbRow.Size + index); if (maxBytes < JsonConstants.StackallocByteThreshold) { Span<byte> utf8Name = stackalloc byte[JsonConstants.StackallocByteThreshold]; int len = JsonReaderHelper.GetUtf8FromText(propertyName, utf8Name); utf8Name = utf8Name.Slice(0, len); return TryGetNamedPropertyValue( startIndex, endIndex, utf8Name, out value); } // Unescaping the property name will make the string shorter (or the same) // So the first viable candidate is one whose length in bytes matches, or // exceeds, our length in chars. // // The maximal escaping seems to be 6 -> 1 ("\u0030" => "0"), but just transcode // and switch once one viable long property is found. int minBytes = propertyName.Length; // Move to the row before the EndObject int candidateIndex = endIndex - DbRow.Size; while (candidateIndex > index) { int passedIndex = candidateIndex; row = _parsedData.Get(candidateIndex); Debug.Assert(row.TokenType != JsonTokenType.PropertyName); // Move before the value if (row.IsSimpleValue) { candidateIndex -= DbRow.Size; } else { Debug.Assert(row.NumberOfRows > 0); candidateIndex -= DbRow.Size * (row.NumberOfRows + 1); } row = _parsedData.Get(candidateIndex); Debug.Assert(row.TokenType == JsonTokenType.PropertyName); if (row.SizeOrLength >= minBytes) { byte[] tmpUtf8 = ArrayPool<byte>.Shared.Rent(maxBytes); Span<byte> utf8Name = default; try { int len = JsonReaderHelper.GetUtf8FromText(propertyName, tmpUtf8); utf8Name = tmpUtf8.AsSpan(0, len); return TryGetNamedPropertyValue( startIndex, passedIndex + DbRow.Size, utf8Name, out value); } finally { // While property names aren't usually a secret, they also usually // aren't long enough to end up in the rented buffer transcode path. // // On the basis that this is user data, go ahead and clear it. utf8Name.Clear(); ArrayPool<byte>.Shared.Return(tmpUtf8); } } // Move to the previous value candidateIndex -= DbRow.Size; } // None of the property names were within the range that the UTF-8 encoding would have been. value = default; return false; } internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<byte> propertyName, out JsonElement value) { CheckNotDisposed(); DbRow row = _parsedData.Get(index); CheckExpectedType(JsonTokenType.StartObject, row.TokenType); // Only one row means it was EndObject. if (row.NumberOfRows == 1) { value = default; return false; } int endIndex = checked(row.NumberOfRows * DbRow.Size + index); return TryGetNamedPropertyValue( index + DbRow.Size, endIndex, propertyName, out value); } private bool TryGetNamedPropertyValue( int startIndex, int endIndex, ReadOnlySpan<byte> propertyName, out JsonElement value) { ReadOnlySpan<byte> documentSpan = _utf8Json.Span; Span<byte> utf8UnescapedStack = stackalloc byte[JsonConstants.StackallocByteThreshold]; // Move to the row before the EndObject int index = endIndex - DbRow.Size; while (index > startIndex) { DbRow row = _parsedData.Get(index); Debug.Assert(row.TokenType != JsonTokenType.PropertyName); // Move before the value if (row.IsSimpleValue) { index -= DbRow.Size; } else { Debug.Assert(row.NumberOfRows > 0); index -= DbRow.Size * (row.NumberOfRows + 1); } row = _parsedData.Get(index); Debug.Assert(row.TokenType == JsonTokenType.PropertyName); ReadOnlySpan<byte> currentPropertyName = documentSpan.Slice(row.Location, row.SizeOrLength); if (row.HasComplexChildren) { // An escaped property name will be longer than an unescaped candidate, so only unescape // when the lengths are compatible. if (currentPropertyName.Length > propertyName.Length) { int idx = currentPropertyName.IndexOf(JsonConstants.BackSlash); Debug.Assert(idx >= 0); // If everything up to where the property name has a backslash matches, keep going. if (propertyName.Length > idx && currentPropertyName.Slice(0, idx).SequenceEqual(propertyName.Slice(0, idx))) { int remaining = currentPropertyName.Length - idx; int written = 0; byte[]? rented = null; try { Span<byte> utf8Unescaped = remaining <= utf8UnescapedStack.Length ? utf8UnescapedStack : (rented = ArrayPool<byte>.Shared.Rent(remaining)); // Only unescape the part we haven't processed. JsonReaderHelper.Unescape(currentPropertyName.Slice(idx), utf8Unescaped, 0, out written); // If the unescaped remainder matches the input remainder, it's a match. if (utf8Unescaped.Slice(0, written).SequenceEqual(propertyName.Slice(idx))) { // If the property name is a match, the answer is the next element. value = new JsonElement(this, index + DbRow.Size); return true; } } finally { if (rented != null) { rented.AsSpan(0, written).Clear(); ArrayPool<byte>.Shared.Return(rented); } } } } } else if (currentPropertyName.SequenceEqual(propertyName)) { // If the property name is a match, the answer is the next element. value = new JsonElement(this, index + DbRow.Size); return true; } // Move to the previous value index -= DbRow.Size; } value = default; return false; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers; using System.Diagnostics; namespace System.Text.Json { public sealed partial class JsonDocument { internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<char> propertyName, out JsonElement value) { CheckNotDisposed(); DbRow row = _parsedData.Get(index); CheckExpectedType(JsonTokenType.StartObject, row.TokenType); // Only one row means it was EndObject. if (row.NumberOfRows == 1) { value = default; return false; } int maxBytes = JsonReaderHelper.s_utf8Encoding.GetMaxByteCount(propertyName.Length); int startIndex = index + DbRow.Size; int endIndex = checked(row.NumberOfRows * DbRow.Size + index); if (maxBytes < JsonConstants.StackallocByteThreshold) { Span<byte> utf8Name = stackalloc byte[JsonConstants.StackallocByteThreshold]; int len = JsonReaderHelper.GetUtf8FromText(propertyName, utf8Name); utf8Name = utf8Name.Slice(0, len); return TryGetNamedPropertyValue( startIndex, endIndex, utf8Name, out value); } // Unescaping the property name will make the string shorter (or the same) // So the first viable candidate is one whose length in bytes matches, or // exceeds, our length in chars. // // The maximal escaping seems to be 6 -> 1 ("\u0030" => "0"), but just transcode // and switch once one viable long property is found. int minBytes = propertyName.Length; // Move to the row before the EndObject int candidateIndex = endIndex - DbRow.Size; while (candidateIndex > index) { int passedIndex = candidateIndex; row = _parsedData.Get(candidateIndex); Debug.Assert(row.TokenType != JsonTokenType.PropertyName); // Move before the value if (row.IsSimpleValue) { candidateIndex -= DbRow.Size; } else { Debug.Assert(row.NumberOfRows > 0); candidateIndex -= DbRow.Size * (row.NumberOfRows + 1); } row = _parsedData.Get(candidateIndex); Debug.Assert(row.TokenType == JsonTokenType.PropertyName); if (row.SizeOrLength >= minBytes) { byte[] tmpUtf8 = ArrayPool<byte>.Shared.Rent(maxBytes); Span<byte> utf8Name = default; try { int len = JsonReaderHelper.GetUtf8FromText(propertyName, tmpUtf8); utf8Name = tmpUtf8.AsSpan(0, len); return TryGetNamedPropertyValue( startIndex, passedIndex + DbRow.Size, utf8Name, out value); } finally { // While property names aren't usually a secret, they also usually // aren't long enough to end up in the rented buffer transcode path. // // On the basis that this is user data, go ahead and clear it. utf8Name.Clear(); ArrayPool<byte>.Shared.Return(tmpUtf8); } } // Move to the previous value candidateIndex -= DbRow.Size; } // None of the property names were within the range that the UTF-8 encoding would have been. value = default; return false; } internal bool TryGetNamedPropertyValue(int index, ReadOnlySpan<byte> propertyName, out JsonElement value) { CheckNotDisposed(); DbRow row = _parsedData.Get(index); CheckExpectedType(JsonTokenType.StartObject, row.TokenType); // Only one row means it was EndObject. if (row.NumberOfRows == 1) { value = default; return false; } int endIndex = checked(row.NumberOfRows * DbRow.Size + index); return TryGetNamedPropertyValue( index + DbRow.Size, endIndex, propertyName, out value); } private bool TryGetNamedPropertyValue( int startIndex, int endIndex, ReadOnlySpan<byte> propertyName, out JsonElement value) { ReadOnlySpan<byte> documentSpan = _utf8Json.Span; Span<byte> utf8UnescapedStack = stackalloc byte[JsonConstants.StackallocByteThreshold]; // Move to the row before the EndObject int index = endIndex - DbRow.Size; while (index > startIndex) { DbRow row = _parsedData.Get(index); Debug.Assert(row.TokenType != JsonTokenType.PropertyName); // Move before the value if (row.IsSimpleValue) { index -= DbRow.Size; } else { Debug.Assert(row.NumberOfRows > 0); index -= DbRow.Size * (row.NumberOfRows + 1); } row = _parsedData.Get(index); Debug.Assert(row.TokenType == JsonTokenType.PropertyName); ReadOnlySpan<byte> currentPropertyName = documentSpan.Slice(row.Location, row.SizeOrLength); if (row.HasComplexChildren) { // An escaped property name will be longer than an unescaped candidate, so only unescape // when the lengths are compatible. if (currentPropertyName.Length > propertyName.Length) { int idx = currentPropertyName.IndexOf(JsonConstants.BackSlash); Debug.Assert(idx >= 0); // If everything up to where the property name has a backslash matches, keep going. if (propertyName.Length > idx && currentPropertyName.Slice(0, idx).SequenceEqual(propertyName.Slice(0, idx))) { int remaining = currentPropertyName.Length - idx; int written = 0; byte[]? rented = null; try { Span<byte> utf8Unescaped = remaining <= utf8UnescapedStack.Length ? utf8UnescapedStack : (rented = ArrayPool<byte>.Shared.Rent(remaining)); // Only unescape the part we haven't processed. JsonReaderHelper.Unescape(currentPropertyName.Slice(idx), utf8Unescaped, 0, out written); // If the unescaped remainder matches the input remainder, it's a match. if (utf8Unescaped.Slice(0, written).SequenceEqual(propertyName.Slice(idx))) { // If the property name is a match, the answer is the next element. value = new JsonElement(this, index + DbRow.Size); return true; } } finally { if (rented != null) { rented.AsSpan(0, written).Clear(); ArrayPool<byte>.Shared.Return(rented); } } } } } else if (currentPropertyName.SequenceEqual(propertyName)) { // If the property name is a match, the answer is the next element. value = new JsonElement(this, index + DbRow.Size); return true; } // Move to the previous value index -= DbRow.Size; } value = default; return false; } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/Methodical/eh/rethrow/samerethrowtwice.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // 119019 // execute the same throw in handler (int f1, f2) twice (accomplished by calling f1 twice) using System; namespace hello { class Class1 { private static TestUtil.TestLog testLog; static Class1() { // Create test writer object to hold expected output System.IO.StringWriter expectedOut = new System.IO.StringWriter(); // Write expected output to string writer object System.Exception exp = new System.Exception(); expectedOut.WriteLine("In f1"); expectedOut.WriteLine("In f2"); expectedOut.WriteLine("In f2's catch " + exp.Message); expectedOut.WriteLine("In f1's catch " + exp.Message); expectedOut.WriteLine("In main's catch1 " + exp.Message); expectedOut.WriteLine("In f1"); expectedOut.WriteLine("In f2"); expectedOut.WriteLine("In f2's catch " + exp.Message); expectedOut.WriteLine("In f1's catch " + exp.Message); expectedOut.WriteLine("In main's catch2 " + exp.Message); // Create and initialize test log object testLog = new TestUtil.TestLog(expectedOut); } static public void f3() { throw new Exception(); } static public void f2() { try { Console.WriteLine("In f2"); f3(); } catch (Exception e) { Console.WriteLine("In f2's catch " + e.Message); throw; } } static public void f1() { try { Console.WriteLine("In f1"); f2(); } catch (Exception e) { Console.WriteLine("In f1's catch " + e.Message); throw; } } static public int Main() { //Start recording testLog.StartRecording(); try { f1(); } catch (Exception e) { Console.WriteLine("In main's catch1 " + e.Message); } try { f1(); } catch (Exception e) { Console.WriteLine("In main's catch2 " + e.Message); } // stop recoding testLog.StopRecording(); return testLog.VerifyOutput(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // 119019 // execute the same throw in handler (int f1, f2) twice (accomplished by calling f1 twice) using System; namespace hello { class Class1 { private static TestUtil.TestLog testLog; static Class1() { // Create test writer object to hold expected output System.IO.StringWriter expectedOut = new System.IO.StringWriter(); // Write expected output to string writer object System.Exception exp = new System.Exception(); expectedOut.WriteLine("In f1"); expectedOut.WriteLine("In f2"); expectedOut.WriteLine("In f2's catch " + exp.Message); expectedOut.WriteLine("In f1's catch " + exp.Message); expectedOut.WriteLine("In main's catch1 " + exp.Message); expectedOut.WriteLine("In f1"); expectedOut.WriteLine("In f2"); expectedOut.WriteLine("In f2's catch " + exp.Message); expectedOut.WriteLine("In f1's catch " + exp.Message); expectedOut.WriteLine("In main's catch2 " + exp.Message); // Create and initialize test log object testLog = new TestUtil.TestLog(expectedOut); } static public void f3() { throw new Exception(); } static public void f2() { try { Console.WriteLine("In f2"); f3(); } catch (Exception e) { Console.WriteLine("In f2's catch " + e.Message); throw; } } static public void f1() { try { Console.WriteLine("In f1"); f2(); } catch (Exception e) { Console.WriteLine("In f1's catch " + e.Message); throw; } } static public int Main() { //Start recording testLog.StartRecording(); try { f1(); } catch (Exception e) { Console.WriteLine("In main's catch1 " + e.Message); } try { f1(); } catch (Exception e) { Console.WriteLine("In main's catch2 " + e.Message); } // stop recoding testLog.StopRecording(); return testLog.VerifyOutput(); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Data.Common/src/System/Data/Common/Int32Storage.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Xml; using System.Collections; using System.Diagnostics.CodeAnalysis; namespace System.Data.Common { internal sealed class Int32Storage : DataStorage { private const int defaultValue = 0; // Convert.ToInt32(null) private int[] _values = default!; // Late-initialized internal Int32Storage(DataColumn column) : base(column, typeof(int), defaultValue, StorageType.Int32) { } public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: long sum = 0; foreach (int record in records) { if (HasValue(record)) { checked { sum += _values[record]; } hasData = true; } } if (hasData) { return sum; } return _nullValue; case AggregateType.Mean: long meanSum = 0; int meanCount = 0; foreach (int record in records) { if (HasValue(record)) { checked { meanSum += _values[record]; } meanCount++; hasData = true; } } if (hasData) { int mean; checked { mean = (int)(meanSum / meanCount); } return mean; } return _nullValue; case AggregateType.Var: case AggregateType.StDev: int count = 0; double var = 0.0f; double prec = 0.0f; double dsum = 0.0f; double sqrsum = 0.0f; foreach (int record in records) { if (HasValue(record)) { dsum += _values[record]; sqrsum += _values[record] * (double)_values[record]; count++; } } if (count > 1) { var = count * sqrsum - (dsum * dsum); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) var = 0; else var = var / (count * (count - 1)); if (kind == AggregateType.StDev) { return Math.Sqrt(var); } return var; } return _nullValue; case AggregateType.Min: int min = int.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = Math.Min(_values[record], min); hasData = true; } } if (hasData) { return min; } return _nullValue; case AggregateType.Max: int max = int.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = Math.Max(_values[record], max); hasData = true; } } if (hasData) { return max; } return _nullValue; case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return _values[records[0]]; } return null!; case AggregateType.Count: count = 0; for (int i = 0; i < records.Length; i++) { if (HasValue(records[i])) { count++; } } return count; } } catch (OverflowException) { throw ExprException.Overflow(typeof(int)); } throw ExceptionBuilder.AggregateException(kind, _dataType); } public override int Compare(int recordNo1, int recordNo2) { int valueNo1 = _values[recordNo1]; int valueNo2 = _values[recordNo2]; if (valueNo1 == defaultValue || valueNo2 == defaultValue) { int bitCheck = CompareBits(recordNo1, recordNo2); if (0 != bitCheck) { return bitCheck; } } //return valueNo1.CompareTo(valueNo2); return (valueNo1 < valueNo2 ? -1 : (valueNo1 > valueNo2 ? 1 : 0)); // similar to Int32.CompareTo(Int32) } public override int CompareValueTo(int recordNo, object? value) { System.Diagnostics.Debug.Assert(0 <= recordNo, "Invalid record"); System.Diagnostics.Debug.Assert(null != value, "null value"); if (_nullValue == value) { return (HasValue(recordNo) ? 1 : 0); } int valueNo1 = _values[recordNo]; if ((defaultValue == valueNo1) && !HasValue(recordNo)) { return -1; } return valueNo1.CompareTo((int)value); //return(valueNo1 < valueNo2 ? -1 : (valueNo1 > valueNo2 ? 1 : 0)); // similar to Int32.CompareTo(Int32) } public override object ConvertValue(object? value) { if (_nullValue != value) { if (null != value) { value = ((IConvertible)value).ToInt32(FormatProvider); } else { value = _nullValue; } } return value; } public override void Copy(int recordNo1, int recordNo2) { CopyBits(recordNo1, recordNo2); _values[recordNo2] = _values[recordNo1]; } public override object Get(int record) { int value = _values[record]; if (value != Int32Storage.defaultValue) { return value; } return GetBits(record); } public override void Set(int record, object value) { System.Diagnostics.Debug.Assert(null != value, "null value"); if (_nullValue == value) { _values[record] = defaultValue; SetNullBit(record, true); } else { _values[record] = ((IConvertible)value).ToInt32(FormatProvider); SetNullBit(record, false); } } public override void SetCapacity(int capacity) { int[] newValues = new int[capacity]; if (null != _values) { Array.Copy(_values, newValues, Math.Min(capacity, _values.Length)); } _values = newValues; base.SetCapacity(capacity); } [RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)] public override object ConvertXmlToObject(string s) { return XmlConvert.ToInt32(s); } [RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)] public override string ConvertObjectToXml(object value) { return XmlConvert.ToString((int)value); } protected override object GetEmptyStorage(int recordCount) { return new int[recordCount]; } protected override void CopyValue(int record, object store, BitArray nullbits, int storeIndex) { int[] typedStore = (int[])store; typedStore[storeIndex] = _values[record]; nullbits.Set(storeIndex, !HasValue(record)); } protected override void SetStorage(object store, BitArray nullbits) { _values = (int[])store; SetNullStorage(nullbits); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Xml; using System.Collections; using System.Diagnostics.CodeAnalysis; namespace System.Data.Common { internal sealed class Int32Storage : DataStorage { private const int defaultValue = 0; // Convert.ToInt32(null) private int[] _values = default!; // Late-initialized internal Int32Storage(DataColumn column) : base(column, typeof(int), defaultValue, StorageType.Int32) { } public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Sum: long sum = 0; foreach (int record in records) { if (HasValue(record)) { checked { sum += _values[record]; } hasData = true; } } if (hasData) { return sum; } return _nullValue; case AggregateType.Mean: long meanSum = 0; int meanCount = 0; foreach (int record in records) { if (HasValue(record)) { checked { meanSum += _values[record]; } meanCount++; hasData = true; } } if (hasData) { int mean; checked { mean = (int)(meanSum / meanCount); } return mean; } return _nullValue; case AggregateType.Var: case AggregateType.StDev: int count = 0; double var = 0.0f; double prec = 0.0f; double dsum = 0.0f; double sqrsum = 0.0f; foreach (int record in records) { if (HasValue(record)) { dsum += _values[record]; sqrsum += _values[record] * (double)_values[record]; count++; } } if (count > 1) { var = count * sqrsum - (dsum * dsum); prec = var / (dsum * dsum); // we are dealing with the risk of a cancellation error // double is guaranteed only for 15 digits so a difference // with a result less than 1e-15 should be considered as zero if ((prec < 1e-15) || (var < 0)) var = 0; else var = var / (count * (count - 1)); if (kind == AggregateType.StDev) { return Math.Sqrt(var); } return var; } return _nullValue; case AggregateType.Min: int min = int.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { min = Math.Min(_values[record], min); hasData = true; } } if (hasData) { return min; } return _nullValue; case AggregateType.Max: int max = int.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (HasValue(record)) { max = Math.Max(_values[record], max); hasData = true; } } if (hasData) { return max; } return _nullValue; case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return _values[records[0]]; } return null!; case AggregateType.Count: count = 0; for (int i = 0; i < records.Length; i++) { if (HasValue(records[i])) { count++; } } return count; } } catch (OverflowException) { throw ExprException.Overflow(typeof(int)); } throw ExceptionBuilder.AggregateException(kind, _dataType); } public override int Compare(int recordNo1, int recordNo2) { int valueNo1 = _values[recordNo1]; int valueNo2 = _values[recordNo2]; if (valueNo1 == defaultValue || valueNo2 == defaultValue) { int bitCheck = CompareBits(recordNo1, recordNo2); if (0 != bitCheck) { return bitCheck; } } //return valueNo1.CompareTo(valueNo2); return (valueNo1 < valueNo2 ? -1 : (valueNo1 > valueNo2 ? 1 : 0)); // similar to Int32.CompareTo(Int32) } public override int CompareValueTo(int recordNo, object? value) { System.Diagnostics.Debug.Assert(0 <= recordNo, "Invalid record"); System.Diagnostics.Debug.Assert(null != value, "null value"); if (_nullValue == value) { return (HasValue(recordNo) ? 1 : 0); } int valueNo1 = _values[recordNo]; if ((defaultValue == valueNo1) && !HasValue(recordNo)) { return -1; } return valueNo1.CompareTo((int)value); //return(valueNo1 < valueNo2 ? -1 : (valueNo1 > valueNo2 ? 1 : 0)); // similar to Int32.CompareTo(Int32) } public override object ConvertValue(object? value) { if (_nullValue != value) { if (null != value) { value = ((IConvertible)value).ToInt32(FormatProvider); } else { value = _nullValue; } } return value; } public override void Copy(int recordNo1, int recordNo2) { CopyBits(recordNo1, recordNo2); _values[recordNo2] = _values[recordNo1]; } public override object Get(int record) { int value = _values[record]; if (value != Int32Storage.defaultValue) { return value; } return GetBits(record); } public override void Set(int record, object value) { System.Diagnostics.Debug.Assert(null != value, "null value"); if (_nullValue == value) { _values[record] = defaultValue; SetNullBit(record, true); } else { _values[record] = ((IConvertible)value).ToInt32(FormatProvider); SetNullBit(record, false); } } public override void SetCapacity(int capacity) { int[] newValues = new int[capacity]; if (null != _values) { Array.Copy(_values, newValues, Math.Min(capacity, _values.Length)); } _values = newValues; base.SetCapacity(capacity); } [RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)] public override object ConvertXmlToObject(string s) { return XmlConvert.ToInt32(s); } [RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)] public override string ConvertObjectToXml(object value) { return XmlConvert.ToString((int)value); } protected override object GetEmptyStorage(int recordCount) { return new int[recordCount]; } protected override void CopyValue(int record, object store, BitArray nullbits, int storeIndex) { int[] typedStore = (int[])store; typedStore[storeIndex] = _values[record]; nullbits.Set(storeIndex, !HasValue(record)); } protected override void SetStorage(object store, BitArray nullbits) { _values = (int[])store; SetNullStorage(nullbits); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Runtime/Directory.Build.props
<Project> <Import Project="..\Directory.Build.props" /> <PropertyGroup> <StrongNameKeyId>Microsoft</StrongNameKeyId> </PropertyGroup> </Project>
<Project> <Import Project="..\Directory.Build.props" /> <PropertyGroup> <StrongNameKeyId>Microsoft</StrongNameKeyId> </PropertyGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/Common/src/System/Security/Cryptography/SecKeyPair.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Cryptography.Apple; namespace System.Security.Cryptography { internal sealed class SecKeyPair : IDisposable { internal SafeSecKeyRefHandle PublicKey { get; private set; } internal SafeSecKeyRefHandle? PrivateKey { get; private set; } private SecKeyPair(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle? privateKey) { PublicKey = publicKey; PrivateKey = privateKey; } public void Dispose() { PrivateKey?.Dispose(); PrivateKey = null; PublicKey?.Dispose(); PublicKey = null!; } internal static SecKeyPair PublicPrivatePair(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey) { if (publicKey == null || publicKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(publicKey)); if (privateKey == null || privateKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(privateKey)); return new SecKeyPair(publicKey, privateKey); } internal static SecKeyPair PublicOnly(SafeSecKeyRefHandle publicKey) { if (publicKey == null || publicKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(publicKey)); return new SecKeyPair(publicKey, null); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Cryptography.Apple; namespace System.Security.Cryptography { internal sealed class SecKeyPair : IDisposable { internal SafeSecKeyRefHandle PublicKey { get; private set; } internal SafeSecKeyRefHandle? PrivateKey { get; private set; } private SecKeyPair(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle? privateKey) { PublicKey = publicKey; PrivateKey = privateKey; } public void Dispose() { PrivateKey?.Dispose(); PrivateKey = null; PublicKey?.Dispose(); PublicKey = null!; } internal static SecKeyPair PublicPrivatePair(SafeSecKeyRefHandle publicKey, SafeSecKeyRefHandle privateKey) { if (publicKey == null || publicKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(publicKey)); if (privateKey == null || privateKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(privateKey)); return new SecKeyPair(publicKey, privateKey); } internal static SecKeyPair PublicOnly(SafeSecKeyRefHandle publicKey) { if (publicKey == null || publicKey.IsInvalid) throw new ArgumentException(SR.Cryptography_OpenInvalidHandle, nameof(publicKey)); return new SecKeyPair(publicKey, null); } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoPointerType.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Diagnostics; namespace System.Reflection.TypeLoading { /// <summary> /// All RoTypes that return true for IsPointer. /// </summary> internal sealed class RoPointerType : RoHasElementType { internal RoPointerType(RoType elementType) : base(elementType) { Debug.Assert(elementType != null); } protected sealed override bool IsArrayImpl() => false; public sealed override bool IsSZArray => false; public sealed override bool IsVariableBoundArray => false; protected sealed override bool IsByRefImpl() => false; protected sealed override bool IsPointerImpl() => true; public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); protected sealed override TypeAttributes ComputeAttributeFlags() => TypeAttributes.Public; protected sealed override string Suffix => "*"; protected sealed override RoType? ComputeBaseTypeWithoutDesktopQuirk() => null; protected sealed override IEnumerable<RoType> ComputeDirectlyImplementedInterfaces() => Array.Empty<RoType>(); internal sealed override IEnumerable<ConstructorInfo> GetConstructorsCore(NameFilter? filter) => Array.Empty<ConstructorInfo>(); internal sealed override IEnumerable<MethodInfo> GetMethodsCore(NameFilter? filter, Type reflectedType) => Array.Empty<MethodInfo>(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Diagnostics; namespace System.Reflection.TypeLoading { /// <summary> /// All RoTypes that return true for IsPointer. /// </summary> internal sealed class RoPointerType : RoHasElementType { internal RoPointerType(RoType elementType) : base(elementType) { Debug.Assert(elementType != null); } protected sealed override bool IsArrayImpl() => false; public sealed override bool IsSZArray => false; public sealed override bool IsVariableBoundArray => false; protected sealed override bool IsByRefImpl() => false; protected sealed override bool IsPointerImpl() => true; public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); protected sealed override TypeAttributes ComputeAttributeFlags() => TypeAttributes.Public; protected sealed override string Suffix => "*"; protected sealed override RoType? ComputeBaseTypeWithoutDesktopQuirk() => null; protected sealed override IEnumerable<RoType> ComputeDirectlyImplementedInterfaces() => Array.Empty<RoType>(); internal sealed override IEnumerable<ConstructorInfo> GetConstructorsCore(NameFilter? filter) => Array.Empty<ConstructorInfo>(); internal sealed override IEnumerable<MethodInfo> GetMethodsCore(NameFilter? filter, Type reflectedType) => Array.Empty<MethodInfo>(); } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/FusedMultiplySubtractBySelectedScalar.Vector64.Single.Vector128.Single.3.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(Single[] inArray1, Single[] inArray2, Single[] inArray3, Single[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Single>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Single, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Single> _fld1; public Vector64<Single> _fld2; public Vector128<Single> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 testClass) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(_fld1, _fld2, _fld3, 3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 testClass) { fixed (Vector64<Single>* pFld1 = &_fld1) fixed (Vector64<Single>* pFld2 = &_fld2) fixed (Vector128<Single>* pFld3 = &_fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly byte Imm = 3; private static Single[] _data1 = new Single[Op1ElementCount]; private static Single[] _data2 = new Single[Op2ElementCount]; private static Single[] _data3 = new Single[Op3ElementCount]; private static Vector64<Single> _clsVar1; private static Vector64<Single> _clsVar2; private static Vector128<Single> _clsVar3; private Vector64<Single> _fld1; private Vector64<Single> _fld2; private Vector128<Single> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); } public SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } _dataTable = new DataTable(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>), typeof(Vector128<Single>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr), (byte)3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>), typeof(Vector128<Single>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)), (byte)3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( _clsVar1, _clsVar2, _clsVar3, 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Single>* pClsVar1 = &_clsVar1) fixed (Vector64<Single>* pClsVar2 = &_clsVar2) fixed (Vector128<Single>* pClsVar3 = &_clsVar3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pClsVar1)), AdvSimd.LoadVector64((Single*)(pClsVar2)), AdvSimd.LoadVector128((Single*)(pClsVar3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(op1, op2, op3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)); var op3 = AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(op1, op2, op3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(test._fld1, test._fld2, test._fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); fixed (Vector64<Single>* pFld1 = &test._fld1) fixed (Vector64<Single>* pFld2 = &test._fld2) fixed (Vector128<Single>* pFld3 = &test._fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(_fld1, _fld2, _fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Single>* pFld1 = &_fld1) fixed (Vector64<Single>* pFld2 = &_fld2) fixed (Vector128<Single>* pFld3 = &_fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(test._fld1, test._fld2, test._fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(&test._fld1)), AdvSimd.LoadVector64((Single*)(&test._fld2)), AdvSimd.LoadVector128((Single*)(&test._fld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Single> op1, Vector64<Single> op2, Vector128<Single> op3, void* result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Single[] inArray3 = new Single[Op3ElementCount]; Single[] outArray = new Single[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Single[] inArray3 = new Single[Op3ElementCount]; Single[] outArray = new Single[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(Single[] firstOp, Single[] secondOp, Single[] thirdOp, Single[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (BitConverter.SingleToInt32Bits(Helpers.FusedMultiplySubtract(firstOp[i], secondOp[i], thirdOp[Imm])) != BitConverter.SingleToInt32Bits(result[i])) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar)}<Single>(Vector64<Single>, Vector64<Single>, Vector128<Single>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(Single[] inArray1, Single[] inArray2, Single[] inArray3, Single[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Single>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Single, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Single> _fld1; public Vector64<Single> _fld2; public Vector128<Single> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 testClass) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(_fld1, _fld2, _fld3, 3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3 testClass) { fixed (Vector64<Single>* pFld1 = &_fld1) fixed (Vector64<Single>* pFld2 = &_fld2) fixed (Vector128<Single>* pFld3 = &_fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single); private static readonly byte Imm = 3; private static Single[] _data1 = new Single[Op1ElementCount]; private static Single[] _data2 = new Single[Op2ElementCount]; private static Single[] _data3 = new Single[Op3ElementCount]; private static Vector64<Single> _clsVar1; private static Vector64<Single> _clsVar2; private static Vector128<Single> _clsVar3; private Vector64<Single> _fld1; private Vector64<Single> _fld2; private Vector128<Single> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); } public SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } _dataTable = new DataTable(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>), typeof(Vector128<Single>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr), (byte)3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>), typeof(Vector128<Single>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)), (byte)3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( _clsVar1, _clsVar2, _clsVar3, 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Single>* pClsVar1 = &_clsVar1) fixed (Vector64<Single>* pClsVar2 = &_clsVar2) fixed (Vector128<Single>* pClsVar3 = &_clsVar3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pClsVar1)), AdvSimd.LoadVector64((Single*)(pClsVar2)), AdvSimd.LoadVector128((Single*)(pClsVar3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray3Ptr); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(op1, op2, op3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr)); var op3 = AdvSimd.LoadVector128((Single*)(_dataTable.inArray3Ptr)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(op1, op2, op3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(test._fld1, test._fld2, test._fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__FusedMultiplySubtractBySelectedScalar_Vector64_Single_Vector128_Single_3(); fixed (Vector64<Single>* pFld1 = &test._fld1) fixed (Vector64<Single>* pFld2 = &test._fld2) fixed (Vector128<Single>* pFld3 = &test._fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(_fld1, _fld2, _fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Single>* pFld1 = &_fld1) fixed (Vector64<Single>* pFld2 = &_fld2) fixed (Vector128<Single>* pFld3 = &_fld3) { var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(pFld1)), AdvSimd.LoadVector64((Single*)(pFld2)), AdvSimd.LoadVector128((Single*)(pFld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar(test._fld1, test._fld2, test._fld3, 3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar( AdvSimd.LoadVector64((Single*)(&test._fld1)), AdvSimd.LoadVector64((Single*)(&test._fld2)), AdvSimd.LoadVector128((Single*)(&test._fld3)), 3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Single> op1, Vector64<Single> op2, Vector128<Single> op3, void* result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Single[] inArray3 = new Single[Op3ElementCount]; Single[] outArray = new Single[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Single[] inArray3 = new Single[Op3ElementCount]; Single[] outArray = new Single[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(Single[] firstOp, Single[] secondOp, Single[] thirdOp, Single[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (BitConverter.SingleToInt32Bits(Helpers.FusedMultiplySubtract(firstOp[i], secondOp[i], thirdOp[Imm])) != BitConverter.SingleToInt32Bits(result[i])) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.FusedMultiplySubtractBySelectedScalar)}<Single>(Vector64<Single>, Vector64<Single>, Vector128<Single>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanGetLower.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void Vector256BooleanGetLower() { bool succeeded = false; try { Vector128<bool> result = default(Vector256<bool>).GetLower(); } catch (NotSupportedException) { succeeded = true; } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector256BooleanGetLower: RunNotSupportedScenario failed to throw NotSupportedException."); TestLibrary.TestFramework.LogInformation(string.Empty); throw new Exception("One or more scenarios did not complete as expected."); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void Vector256BooleanGetLower() { bool succeeded = false; try { Vector128<bool> result = default(Vector256<bool>).GetLower(); } catch (NotSupportedException) { succeeded = true; } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector256BooleanGetLower: RunNotSupportedScenario failed to throw NotSupportedException."); TestLibrary.TestFramework.LogInformation(string.Empty); throw new Exception("One or more scenarios did not complete as expected."); } } } }
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/tests/JIT/Methodical/divrem/rem/u8rem_cs_d.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="u8rem.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="u8rem.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
65,948
Publish crossgen as AOT if supported by the target platform
If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
agocke
2022-02-28T06:12:47Z
2022-04-01T17:22:29Z
7d562f9d2a4285881ae1c412aecb164dc9370013
0d1e04ba2a9ebc9d21a7f65db00407dd0056b547
Publish crossgen as AOT if supported by the target platform. If we're on a platform that supports NativeAOT, this publishes crossgen as NativeAOT. If not, it publishes as self-contained. Trimming is not yet enabled, but will come in a separate PR.
./src/mono/wasm/debugger/tests/ApplyUpdateReferencedAssembly/MethodBody1.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; using System; //keep the same line number for class in the original file and the updates ones namespace ApplyUpdateReferencedAssembly { public class MethodBody1 { public static string StaticMethod1 () { Console.WriteLine("original"); int a = 10; Debugger.Break(); return "OLD STRING"; } } public class MethodBody2 { public static string StaticMethod1 () { Console.WriteLine("original"); int a = 10; Debugger.Break(); return "OLD STRING"; } } public class MethodBody3 { public static string StaticMethod3 () { int a = 10; Console.WriteLine("original"); return "OLD STRING"; } } public class MethodBody4 { public static void StaticMethod4 () { } } public class MethodBody5 { public static void StaticMethod1 () { Console.WriteLine("original"); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; using System; //keep the same line number for class in the original file and the updates ones namespace ApplyUpdateReferencedAssembly { public class MethodBody1 { public static string StaticMethod1 () { Console.WriteLine("original"); int a = 10; Debugger.Break(); return "OLD STRING"; } } public class MethodBody2 { public static string StaticMethod1 () { Console.WriteLine("original"); int a = 10; Debugger.Break(); return "OLD STRING"; } } public class MethodBody3 { public static string StaticMethod3 () { int a = 10; Console.WriteLine("original"); return "OLD STRING"; } } public class MethodBody4 { public static void StaticMethod4 () { } } public class MethodBody5 { public static void StaticMethod1 () { Console.WriteLine("original"); } } }
-1