140
140
// ModeViolation
141
141
// FaultViolation
142
142
// FaultNotFatal
143
- // HostViolation
144
143
// LoadsTypeViolation
145
144
// TakesLockViolation
146
145
//
@@ -378,7 +377,7 @@ struct DbgStateLockState
378
377
379
378
#define CONTRACT_BITMASK_OK_TO_THROW 0x1 << 0
380
379
#define CONTRACT_BITMASK_FAULT_FORBID 0x1 << 1
381
- # define CONTRACT_BITMASK_HOSTCALLS 0x1 << 2
380
+ // Unused 0x1 << 2
382
381
#define CONTRACT_BITMASK_SOTOLERANT 0x1 << 3
383
382
#define CONTRACT_BITMASK_DEBUGONLY 0x1 << 4
384
383
#define CONTRACT_BITMASK_SONOTMAINLINE 0x1 << 5
@@ -422,7 +421,6 @@ struct ClrDebugState
422
421
// By default, GetThread() is perfectly fine to call
423
422
// By default, it's ok to take a lock (or call someone who does)
424
423
m_flags = CONTRACT_BITMASK_OK_TO_THROW|
425
- CONTRACT_BITMASK_HOSTCALLS|
426
424
CONTRACT_BITMASK_SOTOLERANT|
427
425
CONTRACT_BITMASK_OK_TO_LOCK|
428
426
CONTRACT_BITMASK_OK_TO_RETAKE_LOCK;
@@ -512,30 +510,6 @@ struct ClrDebugState
512
510
CONTRACT_BITMASK_RESET (CONTRACT_BITMASK_FAULT_FORBID);
513
511
}
514
512
515
- // --//
516
- BOOL IsHostCaller ()
517
- {
518
- return CONTRACT_BITMASK_IS_SET (CONTRACT_BITMASK_HOSTCALLS);
519
- }
520
-
521
- void SetHostCaller ()
522
- {
523
- CONTRACT_BITMASK_SET (CONTRACT_BITMASK_HOSTCALLS);
524
- }
525
-
526
-
527
- BOOL SetHostCaller (BOOL value)
528
- {
529
- BOOL prevState = CONTRACT_BITMASK_IS_SET (CONTRACT_BITMASK_HOSTCALLS);
530
- CONTRACT_BITMASK_UPDATE (CONTRACT_BITMASK_HOSTCALLS,value);
531
- return prevState;
532
- }
533
-
534
- void ResetHostCaller ()
535
- {
536
- CONTRACT_BITMASK_RESET (CONTRACT_BITMASK_HOSTCALLS);
537
- }
538
-
539
513
// --//
540
514
BOOL IsDebugOnly ()
541
515
{
@@ -896,11 +870,8 @@ class BaseContract
896
870
897
871
SO_MAINLINE_No = 0x00000800 , // code is not part of our mainline SO scenario
898
872
899
- // Any place where we can't safely call into the host should have a HOST_NoCalls contract
900
- HOST_Mask = 0x00003000 ,
901
- HOST_Calls = 0x00002000 ,
902
- HOST_NoCalls = 0x00001000 ,
903
- HOST_Disabled = 0x00000000 , // the default
873
+ // Unused = 0x00002000,
874
+ // Unused = 0x00001000,
904
875
905
876
// These enforce the CAN_TAKE_LOCK / CANNOT_TAKE_LOCK contracts
906
877
CAN_TAKE_LOCK_Mask = 0x00060000 ,
@@ -920,7 +891,7 @@ class BaseContract
920
891
LOADS_TYPE_Disabled = 0x00000000 , // the default
921
892
922
893
ALL_Disabled = THROWS_Disabled|GC_Disabled|FAULT_Disabled|MODE_Disabled|LOADS_TYPE_Disabled|
923
- HOST_Disabled| CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled
894
+ CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled
924
895
925
896
};
926
897
@@ -1124,7 +1095,6 @@ enum ContractViolationBits
1124
1095
FaultNotFatal = 0x00000010 , // suppress INJECT_FAULT but not fault injection by harness
1125
1096
LoadsTypeViolation = 0x00000040 , // suppress LOADS_TYPE tags in this scope
1126
1097
TakesLockViolation = 0x00000080 , // suppress CAN_TAKE_LOCK tags in this scope
1127
- HostViolation = 0x00000100 , // suppress HOST_CALLS tags in this scope
1128
1098
1129
1099
// These are not violation bits. We steal some bits out of the violation mask to serve as
1130
1100
// general flag bits.
@@ -1667,7 +1637,7 @@ class ContractViolationHolder
1667
1637
FORCEINLINE void EnterInternal (UINT_PTR violationMask)
1668
1638
{
1669
1639
_ASSERTE (0 == (violationMask & ~(ThrowsViolation | GCViolation | ModeViolation | FaultViolation |
1670
- FaultNotFatal | HostViolation |
1640
+ FaultNotFatal |
1671
1641
TakesLockViolation | LoadsTypeViolation)) ||
1672
1642
violationMask == AllViolation);
1673
1643
@@ -1738,9 +1708,6 @@ enum PermanentContractViolationReason
1738
1708
ReasonIBC, // Code runs in IBC scenarios only and the violation is safe.
1739
1709
ReasonNGEN, // Code runs in NGEN scenarios only and the violation is safe.
1740
1710
ReasonProfilerCallout, // Profiler implementers are guaranteed not to throw.
1741
- ReasonUnsupportedForSQLF1Profiling, // This code path violates HOST_NOCALLS, but that's ok b/c SQL will never
1742
- // invoke it, and thus SQL/F1 profiling (the primary reason to enforce
1743
- // HOST_NOCALLS) is not in danger.
1744
1711
ReasonRuntimeReentrancy, // e.g. SafeQueryInterface
1745
1712
ReasonShutdownOnly, // Code path only runs as part of Shutdown and the violation is safe.
1746
1713
ReasonSOTolerance, // We would like to redesign SO contracts anyways
@@ -2006,54 +1973,6 @@ inline ClrDebugState *GetClrDebugState(BOOL fAlloc)
2006
1973
2007
1974
return NULL ;
2008
1975
}
2009
- #endif // ENABLE_CONTRACTS_IMPL
2010
-
2011
- #ifdef ENABLE_CONTRACTS_IMPL
2012
-
2013
- class HostNoCallHolder
2014
- {
2015
- public:
2016
- DEBUG_NOINLINE HostNoCallHolder ()
2017
- {
2018
- SCAN_SCOPE_BEGIN;
2019
- STATIC_CONTRACT_HOST_NOCALLS;
2020
-
2021
- m_clrDebugState = GetClrDebugState ();
2022
- m_previousState = m_clrDebugState->SetHostCaller (FALSE );
2023
- }
2024
-
2025
- DEBUG_NOINLINE ~HostNoCallHolder ()
2026
- {
2027
- SCAN_SCOPE_END;
2028
-
2029
- m_clrDebugState->SetHostCaller (m_previousState);
2030
- }
2031
-
2032
- private:
2033
- BOOL m_previousState;
2034
- ClrDebugState* m_clrDebugState;
2035
-
2036
- };
2037
-
2038
- #define BEGIN_HOST_NOCALL_CODE \
2039
- { \
2040
- HostNoCallHolder __hostNoCallHolder; \
2041
- CantAllocHolder __cantAlloc;
2042
-
2043
- #define END_HOST_NOCALL_CODE \
2044
- }
2045
-
2046
- #else // ENABLE_CONTRACTS_IMPL
2047
- #define BEGIN_HOST_NOCALL_CODE \
2048
- { \
2049
- CantAllocHolder __cantAlloc; \
2050
-
2051
- #define END_HOST_NOCALL_CODE \
2052
- }
2053
- #endif
2054
-
2055
-
2056
- #if defined(ENABLE_CONTRACTS_IMPL)
2057
1976
2058
1977
// Macros to indicate we're taking or releasing locks
2059
1978
0 commit comments