Jelajahi Sumber

Replace _M_IX86 || TARGET_64 usage with !defined(_M_ARM)

Sandeep Agarwal 8 tahun lalu
induk
melakukan
f5d52c2bfb

+ 1 - 1
lib/Backend/EmitBuffer.cpp

@@ -217,7 +217,7 @@ EmitBufferManager<TAlloc, TPreReservedAlloc, SyncObject>::FreeAllocation(void* a
                 this->scriptContext->GetThreadContext()->SubCodeSize(allocation->bytesCommitted);
             }
 
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
             if (allocation->allocation->thunkAddress)
             {
                 if (JITManager::GetJITManager()->IsJITServer())

+ 2 - 2
lib/Backend/Func.h

@@ -344,9 +344,9 @@ public:
 static const uint32 c_debugFillPattern4 = 0xcececece;
 static const unsigned __int64 c_debugFillPattern8 = 0xcececececececece;
 
-#if defined(_M_IX86) || defined (_M_ARM)
+#if defined(TARGET_32)
     static const uint32 c_debugFillPattern = c_debugFillPattern4;
-#elif defined(_M_X64) || defined(_M_ARM64)
+#elif defined(TARGET_64)
     static const unsigned __int64 c_debugFillPattern = c_debugFillPattern8;
 #else
 #error unsupported platform

+ 3 - 6
lib/Backend/JITOutput.cpp

@@ -255,13 +255,12 @@ JITOutput::FinalizeNativeCode()
     if (JITManager::GetJITManager()->IsJITServer())
     {
         m_func->GetOOPCodeGenAllocators()->emitBufferManager.CompletePreviousAllocation(m_oopAlloc);
-#if defined(_CONTROL_FLOW_GUARD)
-#if _M_IX86 || TARGET_64
+
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
         if (!m_func->IsLoopBody() && CONFIG_FLAG(UseJITTrampoline))
         {
             allocation->thunkAddress = m_func->GetOOPThreadContext()->GetJITThunkEmitter()->CreateThunk(m_outputData->codeAddress);
         }
-#endif
 #endif
     }
     else
@@ -275,13 +274,11 @@ JITOutput::FinalizeNativeCode()
         m_func->GetInProcJITEntryPointInfo()->SetNumberChunks(numberChunks);
 #endif
 
-#if defined(_CONTROL_FLOW_GUARD)
-#if _M_IX86 || TARGET_64
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
         if (!m_func->IsLoopBody() && CONFIG_FLAG(UseJITTrampoline))
         {
             allocation->thunkAddress = m_func->GetInProcThreadContext()->GetJITThunkEmitter()->CreateThunk(m_outputData->codeAddress);
         }
-#endif
 #endif
     }
     m_outputData->thunkAddress = allocation->thunkAddress;

+ 1 - 1
lib/Backend/JITThunkEmitter.cpp

@@ -5,7 +5,7 @@
 
 #include "Backend.h"
 
-#if defined(ENABLE_NATIVE_CODEGEN) && defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(ENABLE_NATIVE_CODEGEN) && defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
 
 template class JITThunkEmitter<VirtualAllocWrapper>;
 

+ 1 - 1
lib/Backend/JITThunkEmitter.h

@@ -4,7 +4,7 @@
 //-------------------------------------------------------------------------------------------------------
 #pragma once
 
-#if defined(ENABLE_NATIVE_CODEGEN) && defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(ENABLE_NATIVE_CODEGEN) && defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
 template <typename TAlloc>
 class JITThunkEmitter
 {

+ 1 - 1
lib/Backend/Lower.cpp

@@ -81,7 +81,7 @@ Lowerer::Lower()
 
                 IRType opnd1Type;
 
-#if defined(_M_IX86) || defined (_M_ARM)
+#if defined(TARGET_32)
                 opnd1Type = TyInt32;
                 opnd2 = IR::IntConstOpnd::New(Func::c_debugFillPattern4, opnd1Type, m_func);
 #else

+ 1 - 1
lib/Backend/Lower.h

@@ -21,7 +21,7 @@ enum RoundMode : BYTE {
 
 #if defined(_M_IX86) || defined(_M_AMD64)
 #include "LowerMDShared.h"
-#elif defined(_M_ARM) || defined(_M_ARM64)
+#elif defined(_M_ARM32_OR_ARM64)
 #include "LowerMD.h"
 #endif
 

+ 1 - 1
lib/Backend/Opnd.cpp

@@ -458,7 +458,7 @@ Opnd::GetImmediateValue(Func* func)
     }
 }
 
-#if TARGET_32 && !defined(_M_IX86)
+#if defined(_M_ARM)
 int32
 Opnd::GetImmediateValueAsInt32(Func * func)
 {

+ 1 - 1
lib/Backend/Opnd.h

@@ -254,7 +254,7 @@ public:
     void                SetIsDead(const bool isDead = true)   { this->m_isDead = isDead; }
     bool                GetIsDead()   { return this->m_isDead; }
     int64               GetImmediateValue(Func * func);
-#if TARGET_32 && !defined(_M_IX86)
+#if defined(_M_ARM)
     // Helper for 32bits systems without int64 const operand support
     int32               GetImmediateValueAsInt32(Func * func);
 #endif

+ 2 - 2
lib/Backend/ServerThreadContext.cpp

@@ -18,7 +18,7 @@ ServerThreadContext::ServerThreadContext(ThreadContextDataIDL * data, HANDLE pro
     m_sectionAllocator(processHandle),
     m_thunkPageAllocators(nullptr, /* allocXData */ false, &m_sectionAllocator, nullptr, processHandle),
     m_codePageAllocators(nullptr, ALLOC_XDATA, &m_sectionAllocator, &m_preReservedSectionAllocator, processHandle),
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     m_jitThunkEmitter(this, &m_sectionAllocator, processHandle),
 #endif
     m_codeGenAlloc(nullptr, nullptr, this, &m_codePageAllocators, processHandle),
@@ -139,7 +139,7 @@ ServerThreadContext::GetCodeGenAllocators()
     return &m_codeGenAlloc;
 }
 
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
 OOPJITThunkEmitter *
 ServerThreadContext::GetJITThunkEmitter()
 {

+ 2 - 2
lib/Backend/ServerThreadContext.h

@@ -38,7 +38,7 @@ public:
     virtual ptrdiff_t GetCRTBaseAddressDifference() const override;
 
     OOPCodeGenAllocators * GetCodeGenAllocators();
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     OOPJITThunkEmitter * GetJITThunkEmitter();
 #endif
     CustomHeap::OOPCodePageAllocators * GetThunkPageAllocators();
@@ -67,7 +67,7 @@ private:
     CustomHeap::OOPCodePageAllocators m_thunkPageAllocators;
     CustomHeap::OOPCodePageAllocators  m_codePageAllocators;
     OOPCodeGenAllocators m_codeGenAlloc;
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     OOPJITThunkEmitter m_jitThunkEmitter;
 #endif
     // only allocate with this from foreground calls (never from CodeGen calls)

+ 1 - 1
lib/Common/DataStructures/SparseBitVector.h

@@ -205,7 +205,7 @@ BVSparseNode<TAllocator>::BVSparseNode(BVIndex beginIndex, BVSparseNode<TAllocat
 {
     // Performance assert, BVSparseNode is heavily used in the backend, do perf
     // measurement before changing this.
-#if defined(_M_ARM64) || defined(_M_X64)
+#if defined(TARGET_64)
     CompileAssert(sizeof(BVSparseNode) == 24);
 #else
     CompileAssert(sizeof(BVSparseNode) == 16);

+ 1 - 1
lib/Common/Memory/PageAllocator.h

@@ -83,7 +83,7 @@ struct SecondaryAllocation
     }
 };
 
-#if defined(_M_X64) || defined(_M_ARM64)
+#if defined(TARGET_64)
 struct XDataInfo
 {
     RUNTIME_FUNCTION pdata;

+ 4 - 4
lib/JITIDL/JITTypes.h

@@ -20,7 +20,7 @@ cpp_quote("#define USE_RPC_HANDLE_MARSHALLING 1")
 #define USE_RPC_HANDLE_MARSHALLING 1
 #endif
 
-#if defined(_M_IX86) || defined(_M_ARM)
+#if defined(TARGET_32)
 #ifdef __midl
 #define CHAKRA_WB_PTR int
 #else
@@ -28,7 +28,7 @@ cpp_quote("#define USE_RPC_HANDLE_MARSHALLING 1")
 #endif
 #define CHAKRA_PTR int
 #define BV_SHIFT 5
-#elif defined(_M_X64) || defined(_M_ARM64)
+#elif defined(TARGET_64)
 #ifdef __midl
 #define CHAKRA_WB_PTR __int64
 #else
@@ -48,13 +48,13 @@ cpp_quote("#define USE_RPC_HANDLE_MARSHALLING 1")
 #define IDL_PAD2(num) IDL_Field(short) struct_pad_##num;
 #define IDL_PAD4(num) IDL_Field(int) struct_pad_##num;
 
-#if defined(_M_X64) || defined(_M_ARM64)
+#if defined(TARGET_64)
 #define X64_PAD4(num) IDL_Field(int) struct_pad_##num;
 #else
 #define X64_PAD4(num)
 #endif
 
-#if defined(_M_IX86) || defined(_M_ARM)
+#if defined(TARGET_32)
 #define X86_PAD4(num) IDL_Field(int) struct_pad_##num;
 #else
 #define X86_PAD4(num)

+ 1 - 1
lib/JITServer/JITServer.cpp

@@ -267,7 +267,7 @@ ServerInitializeThreadContext(
         {
             *prereservedRegionAddr = (intptr_t)contextInfo->GetPreReservedSectionAllocator()->EnsurePreReservedRegion();
         }
-#if _M_IX86 || TARGET_64
+#if !defined(_M_ARM)
         *jitThunkAddr = (intptr_t)contextInfo->GetJITThunkEmitter()->EnsureInitialized();
 #endif
 #endif

+ 1 - 1
lib/Runtime/Base/FunctionBody.cpp

@@ -3433,7 +3433,7 @@ namespace Js
 #if ENABLE_NATIVE_CODEGEN
         JavascriptMethod originalEntryPoint = this->GetOriginalEntryPoint_Unchecked();
         return
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
             (
 #if ENABLE_OOP_NATIVE_CODEGEN
             JITManager::GetJITManager()->IsOOPJITEnabled()

+ 1 - 1
lib/Runtime/Base/ThreadContext.cpp

@@ -172,7 +172,7 @@ ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager,
     thunkPageAllocators(allocationPolicyManager, /* allocXData */ false, /* virtualAllocator */ nullptr, GetCurrentProcess()),
 #endif
     codePageAllocators(allocationPolicyManager, ALLOC_XDATA, GetPreReservedVirtualAllocator(), GetCurrentProcess()),
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     jitThunkEmitter(this, &VirtualAllocWrapper::Instance , GetCurrentProcess()),
 #endif
 #endif

+ 2 - 2
lib/Runtime/Base/ThreadContext.h

@@ -717,7 +717,7 @@ private:
     CustomHeap::InProcCodePageAllocators thunkPageAllocators;
 #endif
     CustomHeap::InProcCodePageAllocators codePageAllocators;
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     InProcJITThunkEmitter jitThunkEmitter;
 #endif
 #endif
@@ -880,7 +880,7 @@ public:
 #endif
     CustomHeap::InProcCodePageAllocators * GetCodePageAllocators() { return &codePageAllocators; }
 
-#if defined(_CONTROL_FLOW_GUARD) && (_M_IX86 || TARGET_64)
+#if defined(_CONTROL_FLOW_GUARD) && !defined(_M_ARM)
     InProcJITThunkEmitter * GetJITThunkEmitter() { return &jitThunkEmitter; }
 #endif
 #endif // ENABLE_NATIVE_CODEGEN