Standardize on `assert` in the JIT.
authorPat Gavlin <pagavlin@microsoft.com>
Mon, 11 Apr 2016 21:12:21 +0000 (14:12 -0700)
committerPat Gavlin <pagavlin@microsoft.com>
Mon, 18 Apr 2016 17:30:44 +0000 (10:30 -0700)
A small amount of JIT code was using `_ASSERTE` instead of `assert`.
Change that code to use `assert` instead, which operates correctly
w.r.t. the JIT host.

Commit migrated from https://github.com/dotnet/coreclr/commit/9038cb03c0179de2558beb18386b62606d2ea33d

src/coreclr/src/jit/codegenlegacy.cpp
src/coreclr/src/jit/compiler.cpp
src/coreclr/src/jit/disasm.h
src/coreclr/src/jit/gcencode.cpp
src/coreclr/src/jit/gentree.h
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/jitconfig.cpp
src/coreclr/src/jit/utils.cpp
src/coreclr/src/jit/utils.h

index 68364fd..5a0198f 100644 (file)
@@ -17655,7 +17655,7 @@ bool CodeGen::genFillSlotFromPromotedStruct(GenTreePtr        arg,
             noway_assert((curRegNum % 2) == 0);
             // We leave the fieldSize as EA_4BYTE; but we must do 2 reg moves.
             break;
-        default: _ASSERTE(fieldVarDsc->lvExactSize == 4); break;
+        default: assert(fieldVarDsc->lvExactSize == 4); break;
         }
     }
     else
index c50be01..7ccaa18 100644 (file)
@@ -5469,7 +5469,7 @@ START:
 #if defined(_PREFAST_) || defined(_PREFIX_)             
             PREFIX_ASSUME(pParam->pComp != NULL);
 #else
-            _ASSERTE(pParam->pComp != NULL);
+            assert(pParam->pComp != NULL);
 #endif
             
             pParam->pComp->compInit(pParam->pAlloc, pParam->inlineInfo);
index c770920..5afaecd 100644 (file)
@@ -27,7 +27,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 // free() is redefined to cause a runtime error instead of a compile time error.
 #undef free
 #ifdef DEBUG
-#define free(x) _ASSERTE(false && "Must not call free(). Use a ClrXXX function instead.")
+#define free(x) assert(false && "Must not call free(). Use a ClrXXX function instead.")
 #endif
 
 #if CHECK_STRUCT_PADDING
index 9c8c34a..2c4e835 100644 (file)
@@ -1171,7 +1171,7 @@ size_t              GCInfo::gcInfoBlockHdrSave(BYTE*      dest,
     header->gsCookieOffset = INVALID_GS_COOKIE_OFFSET;
     if (compiler->getNeedsGSSecurityCookie())
     {
-        _ASSERTE(compiler->lvaGSSecurityCookie != BAD_VAR_NUM);
+        assert(compiler->lvaGSSecurityCookie != BAD_VAR_NUM);
         int stkOffs = compiler->lvaTable[compiler->lvaGSSecurityCookie].lvStkOffs;
         header->gsCookieOffset = compiler->isFramePointerUsed() ? -stkOffs : stkOffs;
         assert(header->gsCookieOffset != INVALID_GS_COOKIE_OFFSET);
index 4580df6..233c5dc 100644 (file)
@@ -1654,7 +1654,7 @@ public:
 #ifdef DEBUG
   private:
     GenTree& operator=(const GenTree& gt) {
-        _ASSERTE(!"Don't copy");
+        assert(!"Don't copy");
         return *this;
     }
 #endif // DEBUG
index d66659e..eecb58f 100644 (file)
@@ -1597,7 +1597,7 @@ GenTreePtr          Compiler::impLookupToTree(CORINFO_LOOKUP *pLookup, unsigned
 
         CORINFO_GENERIC_HANDLE handle = 0;
         void *pIndirection = 0;
-        _ASSERTE(pLookup->constLookup.accessType != IAT_PPVALUE);
+        assert(pLookup->constLookup.accessType != IAT_PPVALUE);
 
         if (pLookup->constLookup.accessType == IAT_VALUE)
             handle = pLookup->constLookup.handle;
@@ -1821,7 +1821,7 @@ GenTreePtr          Compiler::impRuntimeLookupToTree(CORINFO_RUNTIME_LOOKUP_KIND
         return gtNewLclvNode(tmp, TYP_I_IMPL);
     }
 
-    _ASSERTE(pLookup->indirections != 0);
+    assert(pLookup->indirections != 0);
 
     impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("bubbling QMark1"));  
     
@@ -3274,7 +3274,7 @@ GenTreePtr      Compiler::impArrayAccessIntrinsic(CORINFO_CLASS_HANDLE  clsHnd,
         }
         else
         {
-            _ASSERTE(intrinsicID == CORINFO_INTRINSIC_Array_Address);
+            assert(intrinsicID == CORINFO_INTRINSIC_Array_Address);
 
             // Fetch the return type
             typeInfo retInfo = verMakeTypeInfo(LocalSig.retType, LocalSig.retTypeClass);
index 009b877..7d946da 100644 (file)
@@ -13,7 +13,7 @@ JitConfigValues JitConfig;
 
 void JitConfigValues::MethodSet::initialize(const wchar_t* list, ICorJitHost* host)
 {
-    _ASSERTE(m_list == nullptr);
+    assert(m_list == nullptr);
 
     enum State { NO_NAME, CLS_NAME, FUNC_NAME, ARG_LIST }; // parsing state machine
 
@@ -122,7 +122,7 @@ void JitConfigValues::MethodSet::initialize(const wchar_t* list, ICorJitHost* ho
             if (m_list[i] == '\0' || m_list[i] == SEP_CHAR || m_list[i] == '(')
             {
             DONE_FUNC_NAME:
-                _ASSERTE(m_list[i] == '\0' || m_list[i] == SEP_CHAR || m_list[i] == '(');
+                assert(m_list[i] == '\0' || m_list[i] == SEP_CHAR || m_list[i] == '(');
 
                 if (m_list[nameStart] == '*' && !isQuoted)
                 {
@@ -150,7 +150,7 @@ void JitConfigValues::MethodSet::initialize(const wchar_t* list, ICorJitHost* ho
                 }
                 else
                 {
-                    _ASSERTE(m_list[i] == '(');
+                    assert(m_list[i] == '(');
                     currentName.m_numArgs = -1;
                     state = ARG_LIST;
                 }
@@ -166,13 +166,13 @@ void JitConfigValues::MethodSet::initialize(const wchar_t* list, ICorJitHost* ho
                 }
 
             DONE_ARG_LIST:
-                _ASSERTE(m_list[i] == '\0' || m_list[i] == SEP_CHAR || m_list[i] == ')');
+                assert(m_list[i] == '\0' || m_list[i] == SEP_CHAR || m_list[i] == ')');
 
                 // We have parsed an entire method name; create a new entry in the list for it.
                 MethodName* name = (MethodName*)host->allocateMemory(sizeof(MethodName));
                 *name = currentName;
 
-                _ASSERTE(name->m_next == nullptr);
+                assert(name->m_next == nullptr);
                 *lastName = name;
                 lastName = &name->m_next;
 
@@ -204,7 +204,7 @@ void JitConfigValues::MethodSet::initialize(const wchar_t* list, ICorJitHost* ho
             break;
 
         default:
-            _ASSERTE(!"Bad state");
+            assert(!"Bad state");
             break;
         }
     }
@@ -298,7 +298,7 @@ bool JitConfigValues::MethodSet::contains(const char* methodName, const char* cl
 
 void JitConfigValues::initialize(ICorJitHost* host)
 {
-    _ASSERTE(!m_isInitialized);
+    assert(!m_isInitialized);
 
 #define CONFIG_INTEGER(name, key, defaultValue) m_##name = host->getIntConfigValue(key, defaultValue);
 #define CONFIG_STRING(name, key) m_##name = host->getStringConfigValue(key);
index 2dd47b9..c86d124 100644 (file)
@@ -724,7 +724,7 @@ bool ConfigMethodRange::contains(ICorJitInfo* info, CORINFO_METHOD_HANDLE method
 void ConfigMethodRange::initRanges(const wchar_t* rangeStr)
 {
     // make sure that the memory was zero initialized
-    _ASSERTE(m_inited == 0 || m_inited == 1);
+    assert(m_inited == 0 || m_inited == 1);
 
     if (rangeStr == nullptr)
     {
@@ -1052,10 +1052,10 @@ int SimpleSprintf_s(__in_ecount(cbBufSize - (pWriteStart- pBufStart)) char * pWr
                     __in_ecount(cbBufSize) char * pBufStart, size_t cbBufSize,
                     __in_z const char * fmt, ...)
 {
-    _ASSERTE(fmt);
-    _ASSERTE(pBufStart);
-    _ASSERTE(pWriteStart);
-    _ASSERTE((size_t)pBufStart <= (size_t)pWriteStart);
+    assert(fmt);
+    assert(pBufStart);
+    assert(pWriteStart);
+    assert((size_t)pBufStart <= (size_t)pWriteStart);
     int ret;
 
     //compute the space left in the buffer.
index 75fe119..7f14163 100644 (file)
@@ -97,12 +97,12 @@ public:
     inline void ensureInit(const wchar_t* rangeStr)
     {
         // make sure that the memory was zero initialized
-        _ASSERTE(m_inited == 0 || m_inited == 1);
+        assert(m_inited == 0 || m_inited == 1);
 
         if (!m_inited)
         {
             initRanges(rangeStr);
-            _ASSERTE(m_inited == 1);
+            assert(m_inited == 1);
         }
     }