Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/coreclr/vm/comsynchronizable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,6 @@ extern "C" INT32 QCALLTYPE ThreadNative_GetApartmentState(QCall::ObjectHandleOnS

retVal = thread->GetApartment();

#ifdef FEATURE_COMINTEROP
if (retVal == Thread::AS_Unknown)
{
// If the CLR hasn't started COM yet, start it up and attempt the call again.
// We do this in order to minimize the number of situations under which we return
// ApartmentState.Unknown to our callers.
if (!g_fComStarted)
{
EnsureComStarted();
retVal = thread->GetApartment();
}
}
#endif // FEATURE_COMINTEROP

END_QCALL;
return retVal;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/dllimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3326,7 +3326,7 @@ BOOL PInvoke::MarshalingRequired(
// We enable the runtime marshalling system whenever it is enabled on the module as a whole
// or when the call is a COM interop call. COM interop calls are already using a significant portion of the runtime
// marshalling system just to function at all, so we aren't going to disable the parameter marshalling;
// we'd rather have developers use the feature flag to diable the whole COM interop subsystem at once.
// we'd rather have developers use the feature flag to disable the whole COM interop subsystem at once.
bool runtimeMarshallingEnabled = pModule->IsRuntimeMarshallingEnabled();
#ifdef FEATURE_COMINTEROP
runtimeMarshallingEnabled |= pMD && pMD->IsCLRToCOMCall();
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/vm/finalizerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ static void DoExtraWorkForFinalizer(Thread* finalizerThread)
}
CONTRACTL_END;

#ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT
if (finalizerThread->RequiresCoInitialize())
{
finalizerThread->SetApartment(Thread::AS_InMTA);
}
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT

if (finalizerThread->RequireSyncBlockCleanup())
{
SyncBlockCache::GetSyncBlockCache()->CleanupSyncBlocks();
Expand Down
6 changes: 2 additions & 4 deletions src/coreclr/vm/interoputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,13 @@ HRESULT LoadRegTypeLib(_In_ REFGUID guid,
return hr;
}

VOID EnsureComStarted(BOOL fCoInitCurrentThread)
VOID EnsureComStarted()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(GetThreadNULLOk() || !fCoInitCurrentThread);
PRECONDITION(g_fEEStarted);
}
CONTRACTL_END;
Expand All @@ -1388,15 +1387,14 @@ VOID EnsureComStarted(BOOL fCoInitCurrentThread)
_ASSERTE(g_fComStarted);
}

HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread)
HRESULT EnsureComStartedNoThrow()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(g_fEEStarted);
PRECONDITION(GetThreadNULLOk() != NULL); // Should always be inside BEGIN_EXTERNAL_ENTRYPOINT
}
CONTRACTL_END;

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/interoputil.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ VOID LogRCWDestroy(RCW* pWrap);

//--------------------------------------------------------------------------------
// Ensure COM is started up.
HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread = TRUE);
VOID EnsureComStarted(BOOL fCoInitCurrentThread = TRUE);
HRESULT EnsureComStartedNoThrow();
VOID EnsureComStarted();

IUnknown* MarshalObjectToInterface(OBJECTREF* ppObject, MethodTable* pItfMT, MethodTable* pClassMT, DWORD dwFlags);
void UnmarshalObjectFromInterface(OBJECTREF *ppObjectDest, IUnknown **ppUnkSrc, MethodTable *pItfMT, MethodTable *pClassMT, DWORD dwFlags);
Expand Down
9 changes: 1 addition & 8 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,6 @@ CorInfoType CEEInfo::asCorInfoType(CorElementType eeType,
RETURN res;
}


inline static CorInfoType toJitType(TypeHandle typeHnd, CORINFO_CLASS_HANDLE *clsRet = NULL)
{
WRAPPER_NO_CONTRACT;
return CEEInfo::asCorInfoType(typeHnd.GetInternalCorElementType(), typeHnd, clsRet);
}

enum ConvToJitSigFlags : int
{
CONV_TO_JITSIG_FLAGS_NONE = 0x0,
Expand Down Expand Up @@ -2580,7 +2573,7 @@ CorInfoType CEEInfo::asCorInfoType (CORINFO_CLASS_HANDLE clsHnd)
JIT_TO_EE_TRANSITION();

TypeHandle VMClsHnd(clsHnd);
result = toJitType(VMClsHnd);
result = asCorInfoType(VMClsHnd.GetInternalCorElementType(), VMClsHnd);

EE_TO_JIT_TRANSITION();

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/methodtablebuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5035,7 +5035,7 @@ MethodTableBuilder::ValidateMethods()
}
}

// Make sure that fcalls have a 0 rva. This is assumed by the prejit fixup logic
// Make sure that fcalls have a 0 rva.
if (it.MethodType() == mcFCall && it.RVA() != 0)
{
BuildMethodTableThrowException(BFA_ECALLS_MUST_HAVE_ZERO_RVA, it.Token());
Expand Down
23 changes: 16 additions & 7 deletions src/coreclr/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,8 @@ DWORD GetRuntimeId()
DWORD_PTR Thread::OBJREF_HASH = OBJREF_TABSIZE;
#endif

#ifndef FEATURE_PORTABLE_HELPERS

extern "C" void STDCALL JIT_PatchedCodeStart();
extern "C" void STDCALL JIT_PatchedCodeLast();

Expand Down Expand Up @@ -1024,6 +1026,20 @@ extern "C" void *JIT_WriteBarrier_Table_Loc;
void *JIT_WriteBarrier_Table_Loc = 0;
#endif // TARGET_ARM64 || TARGET_LOONGARCH64 || TARGET_RISCV64

#else // FEATURE_PORTABLE_HELPERS

BOOL IsIPInWriteBarrierCodeCopy(PCODE controlPc)
{
return FALSE;
}

PCODE AdjustWriteBarrierIP(PCODE controlPc)
{
UNREACHABLE();
}

#endif // FEATURE_PORTABLE_HELPERS

#ifndef TARGET_UNIX
// g_TlsIndex is only used by the DAC. Disable optimizations around it to prevent it from getting optimized out.
#pragma optimize("", off)
Expand Down Expand Up @@ -4625,9 +4641,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state)
// This method can be called on current thread only
_ASSERTE(m_OSThreadId == ::GetCurrentThreadId());

// Reset any bits that request for CoInitialize
ResetRequiresCoInitialize();

// Setting the state to AS_Unknown indicates we should CoUninitialize
// the thread.
if (state == AS_Unknown)
Expand Down Expand Up @@ -4788,10 +4801,6 @@ Thread::ApartmentState Thread::SetApartment(ApartmentState state)
}
}

// Since we've just called CoInitialize, COM has effectively been started up.
// To ensure the CLR is aware of this, we need to call EnsureComStarted.
EnsureComStarted(FALSE);

return GetApartment();
}

Expand Down
22 changes: 0 additions & 22 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,6 @@ class Thread
enum ThreadTasks
{
TT_CleanupSyncBlock = 0x00000001, // The synch block needs to be cleaned up.
#ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT
TT_CallCoInitialize = 0x00000002, // CoInitialize needs to be called.
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
};

// Thread flags that have no concurrency issues (i.e., they are only manipulated by the owning thread). Use these
Expand Down Expand Up @@ -759,7 +756,6 @@ class Thread
{
LIMITED_METHOD_CONTRACT;
InterlockedOr((LONG*)&m_State, TS_CoInitialized);
InterlockedAnd((LONG*)&m_ThreadTasks, ~TT_CallCoInitialize);
}

void ResetCoInitialized()
Expand All @@ -782,24 +778,6 @@ class Thread
}
#endif // FEATURE_COMINTEROP

DWORD RequiresCoInitialize()
{
LIMITED_METHOD_CONTRACT;
return (m_ThreadTasks & TT_CallCoInitialize);
}

void SetRequiresCoInitialize()
{
LIMITED_METHOD_CONTRACT;
InterlockedOr((LONG*)&m_ThreadTasks, TT_CallCoInitialize);
}

void ResetRequiresCoInitialize()
{
LIMITED_METHOD_CONTRACT;
InterlockedAnd((LONG*)&m_ThreadTasks,~TT_CallCoInitialize);
}

void CleanupCOMState();

#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
Expand Down
10 changes: 0 additions & 10 deletions src/coreclr/vm/wasm/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ extern "C" void STDCALL FixupPrecodeCode_End()
PORTABILITY_ASSERT("FixupPrecodeCode_End is not implemented on wasm");
}

extern "C" void STDCALL JIT_PatchedCodeLast()
{
PORTABILITY_ASSERT("JIT_PatchedCodeLast is not implemented on wasm");
}

extern "C" void STDCALL JIT_PatchedCodeStart()
{
PORTABILITY_ASSERT("JIT_PatchedCodeStart is not implemented on wasm");
}

extern "C" void RhpInitialInterfaceDispatch()
{
PORTABILITY_ASSERT("RhpInitialInterfaceDispatch is not implemented on wasm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static partial class PlatformDetection
public static bool IsX64Process => RuntimeInformation.ProcessArchitecture == Architecture.X64;
public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86;
public static bool IsNotX86Process => !IsX86Process;
public static bool IsArgIteratorSupported => IsMonoRuntime || (IsWindows && IsNotArmProcess && !IsNativeAot);
public static bool IsArgIteratorSupported => IsMonoRuntime || (IsWindows && !IsNativeAot);
public static bool IsArgIteratorNotSupported => !IsArgIteratorSupported;
public static bool Is32BitProcess => IntPtr.Size == 4;
public static bool Is64BitProcess => IntPtr.Size == 8;
Expand Down
32 changes: 15 additions & 17 deletions src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,39 @@
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

using System.Diagnostics.CodeAnalysis;

namespace System.Reflection.Metadata
{
public static partial class AssemblyExtensions
{
[System.CLSCompliantAttribute(false)]
public unsafe static bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true)]
public sealed partial class MetadataUpdateHandlerAttribute : System.Attribute
{
public MetadataUpdateHandlerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type handlerType) { }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Type HandlerType { get { throw null; } }
}
public static partial class MetadataUpdater
{
public static void ApplyUpdate(Assembly assembly, ReadOnlySpan<byte> metadataDelta, ReadOnlySpan<byte> ilDelta, ReadOnlySpan<byte> pdbDelta) { throw null; }
[System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute("System.Reflection.Metadata.MetadataUpdater.IsSupported")]
public static bool IsSupported { get { throw null; } }
}
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class MetadataUpdateHandlerAttribute : System.Attribute
{
public MetadataUpdateHandlerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type handlerType) { }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]
public System.Type HandlerType { get { throw null; } }
public static void ApplyUpdate(System.Reflection.Assembly assembly, System.ReadOnlySpan<byte> metadataDelta, System.ReadOnlySpan<byte> ilDelta, System.ReadOnlySpan<byte> pdbDelta) { }
}
}
namespace System.Runtime.CompilerServices
{
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = false)]
public sealed class CreateNewOnMetadataUpdateAttribute : System.Attribute
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false)]
public sealed partial class CreateNewOnMetadataUpdateAttribute : System.Attribute
{
public CreateNewOnMetadataUpdateAttribute() { }
}
[AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct,
AllowMultiple=false, Inherited=false)]
public class MetadataUpdateOriginalTypeAttribute : Attribute
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public partial class MetadataUpdateOriginalTypeAttribute : System.Attribute
{
public MetadataUpdateOriginalTypeAttribute(Type originalType) { throw null; }
public Type OriginalType { get { throw null; } }
public MetadataUpdateOriginalTypeAttribute(System.Type originalType) { }
public System.Type OriginalType { get { throw null; } }
}
}
namespace System.Runtime.Loader
Expand Down
Loading