#endif // FEATURE_SIMD
// importer has a separate mechanism to retype calls to helpers,
// keep it for now.
- assert(user->TypeIs(TYP_REF));
+ assert(user->TypeIs(TYP_REF) || (user->TypeIs(TYP_I_IMPL) && comp->IsTargetAbi(CORINFO_CORERT_ABI)));
assert(call->IsHelperCall());
assert(returnType == user->TypeGet());
break;
public override bool Equals(object o)
{
// Its only valid to compare two FieldDescs in the same context
- Debug.Assert(object.ReferenceEquals(o, null) || !(o is FieldDesc) || object.ReferenceEquals(((FieldDesc)o).Context, this.Context));
+ Debug.Assert(o is not FieldDesc || object.ReferenceEquals(((FieldDesc)o).Context, this.Context));
return object.ReferenceEquals(this, o);
}
public override bool Equals(object o)
{
// Its only valid to compare two MethodDescs in the same context
- Debug.Assert(object.ReferenceEquals(o, null) || !(o is MethodDesc) || object.ReferenceEquals(((MethodDesc)o).Context, this.Context));
+ Debug.Assert(o is not MethodDesc || object.ReferenceEquals(((MethodDesc)o).Context, this.Context));
return object.ReferenceEquals(this, o);
}
public override bool Equals(object o)
{
// Its only valid to compare two TypeDescs in the same context
- Debug.Assert(o == null || !(o is TypeDesc) || object.ReferenceEquals(((TypeDesc)o).Context, this.Context));
+ Debug.Assert(o is not TypeDesc || object.ReferenceEquals(((TypeDesc)o).Context, this.Context));
return object.ReferenceEquals(this, o);
}
public static bool operator ==(TypeDesc left, TypeDesc right)
{
// Its only valid to compare two TypeDescs in the same context
- Debug.Assert(object.ReferenceEquals(left, null) || object.ReferenceEquals(right, null) || object.ReferenceEquals(left.Context, right.Context));
+ Debug.Assert(left is null || right is null || object.ReferenceEquals(left.Context, right.Context));
return object.ReferenceEquals(left, right);
}
public static bool operator !=(TypeDesc left, TypeDesc right)
{
// Its only valid to compare two TypeDescs in the same context
- Debug.Assert(object.ReferenceEquals(left, null) || object.ReferenceEquals(right, null) || object.ReferenceEquals(left.Context, right.Context));
+ Debug.Assert(left is null || right is null || object.ReferenceEquals(left.Context, right.Context));
return !object.ReferenceEquals(left, right);
}
#endif
public override Void AppendName(StringBuilder sb, SignatureTypeVariable type, FormatOptions options)
{
- sb.Append("!");
+ sb.Append('!');
sb.Append(type.Index.ToStringInvariant());
return Void.Value;
{
sb.Length = initialLen;
- //
AssemblyQualify(sb, type, options);
NamespaceQualify(sb, type, options);
sb.Append(type.DiagnosticName);
var ctor = ManagedType.GetParameterlessConstructor();
if (ctor == null || ((MetadataType)ManagedType).IsAbstract)
{
-#if READYTORUN
- // Let the runtime generate the proper MissingMemberException for this.
- throw new NotSupportedException();
-#else
- var emitter = _ilCodeStreams.Emitter;
-
- MethodSignature ctorSignature = new MethodSignature(0, 0, Context.GetWellKnownType(WellKnownType.Void),
- new TypeDesc[] {
- Context.GetWellKnownType(WellKnownType.String)
- });
- MethodDesc exceptionCtor = InteropTypes.GetMissingMemberException(Context).GetKnownMethod(".ctor", ctorSignature);
-
- string name = ((MetadataType)ManagedType).Name;
- codeStream.Emit(ILOpcode.ldstr, emitter.NewToken(String.Format("'{0}' does not have a default constructor. Subclasses of SafeHandle must have a default constructor to support marshaling a Windows HANDLE into managed code.", name)));
- codeStream.Emit(ILOpcode.newobj, emitter.NewToken(exceptionCtor));
- codeStream.Emit(ILOpcode.throw_);
-
- return;
-#endif
+ ThrowHelper.ThrowMissingMethodException(ManagedType, ".ctor",
+ new MethodSignature(MethodSignatureFlags.None, genericParameterCount: 0,
+ ManagedType.Context.GetWellKnownType(WellKnownType.Void), TypeDesc.EmptyTypes));
}
codeStream.Emit(ILOpcode.newobj, _ilCodeStreams.Emitter.NewToken(ctor));
return context.SystemModule.GetKnownType("System.Runtime.InteropServices", "HandleRef");
}
- public static MetadataType GetMissingMemberException(TypeSystemContext context)
- {
- return context.SystemModule.GetKnownType("System", "MissingMemberException");
- }
-
public static MetadataType GetPInvokeMarshal(TypeSystemContext context)
{
return context.SystemModule.GetKnownType("System.Runtime.InteropServices", "PInvokeMarshal");
<OutputType>Library</OutputType>
<RootNamespace>ILCompiler.DependencyAnalysisFramework</RootNamespace>
<AssemblyName>ILCompiler.DependencyAnalysisFramework</AssemblyName>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Platforms>x64;x86</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<RootNamespace>Internal.TypeSystem</RootNamespace>
<AssemblyName>ILCompiler.TypeSystem.ReadyToRun</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Platforms>x64;x86</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
private static string GetBaseDirectoryCore()
{
// Fallback path for hosts that do not set APP_CONTEXT_BASE_DIRECTORY explicitly
- string? directory = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
+#if CORERT
+ string? path = Environment.ProcessPath;
+#else
+ string? path = Assembly.GetEntryAssembly()?.Location;
+#endif
+
+ string? directory = Path.GetDirectoryName(path);
if (directory == null)
return string.Empty;
// Allow an object to free resources before the object is reclaimed by the GC.
// This method's virtual slot number is hardcoded in runtimes. Do not add any virtual methods ahead of this.
[NonVersionable]
- [SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers", Justification = "Base finalizer method on Object")]
+#pragma warning disable CA1821 // Remove empty Finalizers
~Object()
{
}
+#pragma warning restore CA1821
// Returns a String which represents the object instance. The default
// for an object is to return the fully qualified name of the class.