Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete unused legacy hosting flags #112975

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions src/coreclr/dlls/mscoree/exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ static LPCWSTR* StringArrayToUnicode(int argc, LPCSTR* argv)

static void InitializeStartupFlags(STARTUP_FLAGS* startupFlagsRef)
{
STARTUP_FLAGS startupFlags = static_cast<STARTUP_FLAGS>(
STARTUP_FLAGS::STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN |
STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN);
STARTUP_FLAGS startupFlags = static_cast<STARTUP_FLAGS>(0);

if (Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), CLRConfig::UNSUPPORTED_gcConcurrent))
{
Expand Down Expand Up @@ -313,7 +311,7 @@ int coreclr_initialize(

hr = host->CreateAppDomainWithManager(
appDomainFriendlyNameW,
APPDOMAIN_SECURITY_DEFAULT,
0,
NULL, // Name of the assembly that contains the AppDomainManager implementation
NULL, // The AppDomainManager implementation type name
propertyCount,
Expand Down
40 changes: 0 additions & 40 deletions src/coreclr/inc/mscoree.idl
Original file line number Diff line number Diff line change
Expand Up @@ -36,58 +36,18 @@ cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0

typedef HRESULT (__stdcall *FExecuteInAppDomainCallback) (void* cookie);

// By default GC is concurrent and only the base system library is loaded into the domain-neutral area.
typedef enum {
STARTUP_CONCURRENT_GC = 0x1,

STARTUP_LOADER_OPTIMIZATION_MASK = 0x3<<1, // loader optimization mask
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = 0x1<<1, // no domain neutral loading
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = 0x2<<1, // all domain neutral loading
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = 0x3<<1, // strong name domain neutral loading
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is LoaderOptimizationAttribute specifying these flags. Now all the flags are deprecated, should the attribute be considered for deprecation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. I think you can find number of attribute types that were added for compatibility with .NET Framework and that have no effect in .NET Core.



STARTUP_LOADER_SAFEMODE = 0x10, // Do not apply runtime version policy to the version passed in
STARTUP_LOADER_SETPREFERENCE = 0x100, // Set preferred runtime. Do not actally start it

STARTUP_SERVER_GC = 0x1000, // Use server GC
STARTUP_HOARD_GC_VM = 0x2000, // GC keeps virtual address used
STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000, // Disallow mixing hosting interface
STARTUP_LEGACY_IMPERSONATION = 0x10000, // Do not flow impersonation across async points by default
STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000, // Don't eagerly commit thread stack
STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000, // Force flow impersonation across async points
// (impersonations achieved thru p/invoke and managed will flow.
// default is to flow only managed impersonation)
STARTUP_TRIM_GC_COMMIT = 0x80000, // GC uses less committed space when system memory low
STARTUP_ETW = 0x100000,
STARTUP_ARM = 0x400000, // Enable the ARM feature.
STARTUP_SINGLE_APPDOMAIN = 0x800000, // application runs in default domain, no more domains are created
STARTUP_APPX_APP_MODEL = 0x1000000, // jupiter app
STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000 // Disable the randomized string hashing (not supported)
} STARTUP_FLAGS;

typedef enum
{
APPDOMAIN_SECURITY_DEFAULT =0x0,
APPDOMAIN_SECURITY_SANDBOXED = 0x1, // appdomain is sandboxed
APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2, // no cross ad reverse pinvokes
APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4, //
APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x08, // do not pump messages during wait operations, do not call sync context
// When passed by the host, this flag will allow any assembly to perform PInvoke or COMInterop operations.
// Otherwise, by default, only platform assemblies can perform those operations.
APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,

APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,

APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100,
} APPDOMAIN_SECURITY_FLAGS;

typedef enum {
WAIT_MSGPUMP = 0x1,
WAIT_ALERTABLE = 0x2,
WAIT_NOTINDEADLOCK = 0x4
}WAIT_OPTION;

typedef enum {
// Default to minidump
DUMP_FLAVOR_Mini = 0,
Expand Down
32 changes: 0 additions & 32 deletions src/coreclr/pal/prebuilt/inc/mscoree.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,48 +86,16 @@ typedef /* [public][public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0001
{
STARTUP_CONCURRENT_GC = 0x1,
STARTUP_LOADER_OPTIMIZATION_MASK = ( 0x3 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = ( 0x1 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = ( 0x2 << 1 ) ,
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = ( 0x3 << 1 ) ,
STARTUP_LOADER_SAFEMODE = 0x10,
STARTUP_LOADER_SETPREFERENCE = 0x100,
STARTUP_SERVER_GC = 0x1000,
STARTUP_HOARD_GC_VM = 0x2000,
STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000,
STARTUP_LEGACY_IMPERSONATION = 0x10000,
STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000,
STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000,
STARTUP_TRIM_GC_COMMIT = 0x80000,
STARTUP_ETW = 0x100000,
STARTUP_ARM = 0x400000,
STARTUP_SINGLE_APPDOMAIN = 0x800000,
STARTUP_APPX_APP_MODEL = 0x1000000,
STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000
} STARTUP_FLAGS;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0002
{
APPDOMAIN_SECURITY_DEFAULT = 0,
APPDOMAIN_SECURITY_SANDBOXED = 0x1,
APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2,
APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4,
APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x8,
APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,
APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,
APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100
} APPDOMAIN_SECURITY_FLAGS;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0003
{
WAIT_MSGPUMP = 0x1,
WAIT_ALERTABLE = 0x2,
WAIT_NOTINDEADLOCK = 0x4
} WAIT_OPTION;

typedef /* [public] */
enum __MIDL___MIDL_itf_mscoree_0000_0000_0004
{
Expand Down
55 changes: 1 addition & 54 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ void AppDomain::Create()

_ASSERTE(m_pTheAppDomain == NULL);

AppDomainRefHolder pDomain(new AppDomain());
NewHolder<AppDomain> pDomain(new AppDomain());
pDomain->Init();
pDomain->SetStage(AppDomain::STAGE_OPEN);
pDomain->CreateDefaultBinder();
Expand Down Expand Up @@ -1625,16 +1625,13 @@ AppDomain::AppDomain()
, m_pDelayedLoaderAllocatorUnloadList{NULL}
, m_friendlyName{NULL}
, m_pRootAssembly{NULL}
, m_dwFlags{0}
, m_cRef{1}
#ifdef FEATURE_COMINTEROP
, m_pRCWCache{NULL}
#endif //FEATURE_COMINTEROP
#ifdef FEATURE_COMWRAPPERS
, m_pRCWRefCache{NULL}
#endif // FEATURE_COMWRAPPERS
, m_Stage{STAGE_CREATING}
, m_MemoryPressure{0}
, m_ForceTrivialWaitOperations{false}
#ifdef FEATURE_TYPEEQUIVALENCE
, m_pTypeEquivalenceTable{NULL}
Expand Down Expand Up @@ -3364,35 +3361,6 @@ PEAssembly *AppDomain::TryResolveAssemblyUsingEvent(AssemblySpec *pSpec)
return result;
}


ULONG AppDomain::AddRef()
{
LIMITED_METHOD_CONTRACT;
return InterlockedIncrement(&m_cRef);
}

ULONG AppDomain::Release()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(m_cRef > 0);
}
CONTRACTL_END;

ULONG cRef = InterlockedDecrement(&m_cRef);
if (!cRef)
{
_ASSERTE (m_Stage == STAGE_CREATING);
delete this;
}
return (cRef);
}



void AppDomain::RaiseLoadingAssemblyEvent(Assembly *pAssembly)
{
CONTRACTL
Expand Down Expand Up @@ -4388,27 +4356,6 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB
}
#endif // !defined(DACCESS_COMPILE)

//approximate size of loader data
//maintained for each assembly
#define APPROX_LOADER_DATA_PER_ASSEMBLY 8196

size_t AppDomain::EstimateSize()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

size_t retval = sizeof(AppDomain);
retval += GetLoaderAllocator()->EstimateSize();
//very rough estimate
retval += GetAssemblyCount() * APPROX_LOADER_DATA_PER_ASSEMBLY;
return retval;
}

#ifdef DACCESS_COMPILE

void
Expand Down
57 changes: 0 additions & 57 deletions src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ class RCWCache;
class RCWRefCache;
#endif // FEATURE_COMWRAPPERS

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4200) // Disable zero-sized array warning
#endif


#ifdef _MSC_VER
#pragma warning(pop)
#endif


// The pinned heap handle bucket class is used to contain handles allocated
// from an array contained in the pinned heap.
class PinnedHeapHandleBucket
Expand Down Expand Up @@ -1139,14 +1128,6 @@ class AppDomain final

BOOL ContainsAssembly(Assembly * assem);

//****************************************************************************************
//
// Reference count. When an appdomain is first created the reference is bump
// to one when it is added to the list of domains (see SystemDomain). An explicit
// Removal from the list is necessary before it will be deleted.
ULONG AddRef(void);
ULONG Release(void) DAC_EMPTY_RET(0);

//****************************************************************************************
LPCWSTR GetFriendlyName();
LPCWSTR GetFriendlyNameForDebugger();
Expand Down Expand Up @@ -1243,20 +1224,6 @@ class AppDomain final
// Only call this routine when you can guarantee there are no loads in progress.
void ClearBinderContext();

void SetIgnoreUnhandledExceptions()
{
LIMITED_METHOD_CONTRACT;

m_dwFlags |= IGNORE_UNHANDLED_EXCEPTIONS;
}

BOOL IgnoreUnhandledExceptions()
{
LIMITED_METHOD_CONTRACT;

return (m_dwFlags & IGNORE_UNHANDLED_EXCEPTIONS);
}

static void ExceptionUnwind(Frame *pFrame);

BOOL IsActive()
Expand Down Expand Up @@ -1351,7 +1318,6 @@ class AppDomain final
PTR_LoaderHeap GetHighFrequencyHeap();

private:
size_t EstimateSize();
EEClassFactoryInfoHashTable* SetupClassFactHash();
#ifdef FEATURE_COMINTEROP
DispIDCache* SetupRefDispIDCache();
Expand Down Expand Up @@ -1433,9 +1399,6 @@ class AppDomain final
return GetLoaderAllocator()->GetGCRefPoint();
}

void AddMemoryPressure();
void RemoveMemoryPressure();

PTR_Assembly GetRootAssembly()
{
LIMITED_METHOD_CONTRACT;
Expand All @@ -1462,13 +1425,6 @@ class AppDomain final
PTR_CWSTR m_friendlyName;
PTR_Assembly m_pRootAssembly;

// General purpose flags.
DWORD m_dwFlags;

// When an application domain is created the ref count is artificially incremented
// by one. For it to hit zero an explicit close must have happened.
LONG m_cRef; // Ref count.

// Map of loaded composite native images indexed by base load addresses
CrstExplicitInit m_nativeImageLoadCrst;
MapSHash<LPCUTF8, PTR_NativeImage, NativeImageIndexTraits> m_nativeImageMap;
Expand Down Expand Up @@ -1583,14 +1539,7 @@ class AppDomain final

public:

enum {
CONTEXT_INITIALIZED = 0x0001,
// unused = 0x0400,
IGNORE_UNHANDLED_EXCEPTIONS = 0x10000, // AppDomain was created using the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag
};

AssemblySpecBindingCache m_AssemblyCache;
size_t m_MemoryPressure;

ArrayList m_NativeDllSearchDirectories;
bool m_ForceTrivialWaitOperations;
Expand Down Expand Up @@ -1669,9 +1618,6 @@ class AppDomain final
#endif
}; // class AppDomain

// Just a ref holder
typedef ReleaseHolder<AppDomain> AppDomainRefHolder;

typedef DPTR(class SystemDomain) PTR_SystemDomain;

class SystemDomain final
Expand Down Expand Up @@ -1962,9 +1908,6 @@ class SystemDomain final

InlineSString<100> m_SystemDirectory;

// <TODO>@TODO: CTS, we can keep the com modules in a single assembly or in different assemblies.
// We are currently using different assemblies but this is potentitially to slow...</TODO>

// Global domain that every one uses
SPTR_DECL(SystemDomain, m_pSystemDomain);

Expand Down
18 changes: 0 additions & 18 deletions src/coreclr/vm/appdomain.inl
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,8 @@
#ifndef _APPDOMAIN_I
#define _APPDOMAIN_I

#ifndef DACCESS_COMPILE

#include "appdomain.hpp"

inline void AppDomain::AddMemoryPressure()
{
STANDARD_VM_CONTRACT;
m_MemoryPressure=EstimateSize();
GCInterface::AddMemoryPressure(m_MemoryPressure);
}

inline void AppDomain::RemoveMemoryPressure()
{
WRAPPER_NO_CONTRACT;

GCInterface::RemoveMemoryPressure(m_MemoryPressure);
}

#endif // DACCESS_COMPILE

inline AppDomain::PathIterator AppDomain::IterateNativeDllSearchDirectories()
{
WRAPPER_NO_CONTRACT;
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,6 @@ HRESULT CorHost2::CreateAppDomainWithManager(

ETW::LoaderLog::DomainLoad((LPWSTR)wszFriendlyName);

if (dwFlags & APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS)
pDomain->SetIgnoreUnhandledExceptions();

if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
pDomain->SetForceTrivialWaitOperations();

Expand Down
Loading