Parcourir la source

xplat: remove win64 for good

xplat was using some x86 codes / definitions for x64 due to win64 macro usage.
This PR will fix some of the slow test fails those we were experiencing recently on ccrobot
Oguz Bastemur il y a 8 ans
Parent
commit
81a241a09d

+ 20 - 20
lib/Backend/BackwardPass.cpp

@@ -160,7 +160,7 @@ BackwardPass::DoTrackNegativeZero() const
 bool
 BackwardPass::DoTrackBitOpsOrNumber() const
 {
-#if _WIN64
+#if defined(_WIN32) && defined(TARGET_64)
     return
         !PHASE_OFF1(Js::TypedArrayVirtualPhase) &&
         tag == Js::BackwardPhase &&
@@ -316,8 +316,8 @@ BackwardPass::ProcessBailOnStackArgsOutOfActualsRange()
 {
     IR::Instr * instr = this->currentInstr;
 
-    if (tag == Js::DeadStorePhase && 
-        (instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) && 
+    if (tag == Js::DeadStorePhase &&
+        (instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
         instr->HasBailOutInfo() && !IsPrePass())
     {
         if (instr->DoStackArgsOpt(this->func))
@@ -1735,7 +1735,7 @@ BackwardPass::ProcessBailOutCopyProps(BailOutInfo * bailOutInfo, BVSparse<JitAre
             StackSym * float64StackSym = nullptr;
             StackSym * simd128StackSym = nullptr;
 
-            // If the sym is type specialized, we need to check for upward exposed uses of the specialized sym and not the equivalent var sym. If there are no 
+            // If the sym is type specialized, we need to check for upward exposed uses of the specialized sym and not the equivalent var sym. If there are no
             // uses and we use the copy prop sym to restore, we'll need to find the type specialize sym for that sym as well.
             StackSym * typeSpecSym = nullptr;
             auto findTypeSpecSym = [&]()
@@ -2590,7 +2590,7 @@ BackwardPass::ProcessBlock(BasicBlock * block)
 
         this->currentInstr = instr;
         this->currentRegion = this->currentBlock->GetFirstInstr()->AsLabelInstr()->GetRegion();
-        
+
         IR::Instr * insertedInstr = TryChangeInstrForStackArgOpt();
         if (insertedInstr != nullptr)
         {
@@ -2600,7 +2600,7 @@ BackwardPass::ProcessBlock(BasicBlock * block)
 
         MarkScopeObjSymUseForStackArgOpt();
         ProcessBailOnStackArgsOutOfActualsRange();
-        
+
         if (ProcessNoImplicitCallUses(instr) || this->ProcessBailOutInfo(instr))
         {
             continue;
@@ -2943,7 +2943,7 @@ BackwardPass::ProcessBlock(BasicBlock * block)
 #endif
 }
 
-bool 
+bool
 BackwardPass::CanDeadStoreInstrForScopeObjRemoval(Sym *sym) const
 {
     if (tag == Js::DeadStorePhase && this->currentInstr->m_func->IsStackArgsEnabled())
@@ -3099,7 +3099,7 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
             case Js::OpCode::GetCachedFunc:
             {
                 // <dst> = GetCachedFunc <scopeObject>, <functionNum>
-                // is converted to 
+                // is converted to
                 // <dst> = NewScFunc <functionNum>, <env: FrameDisplay>
 
                 if (instr->GetSrc1()->IsScopeObjOpnd(currFunc))
@@ -3161,8 +3161,8 @@ BackwardPass::TryChangeInstrForStackArgOpt()
     *   -This is to facilitate Bailout to record the live Scope object Sym, whenever required.
     *   -Reason for doing is this because - Scope object has to be implicitly live whenever Heap Arguments object is live.
     *   -When we restore HeapArguments object in the bail out path, it expects the scope object also to be restored - if one was created.
-    *   -We do not know detailed information about Heap arguments obj syms(aliasing etc.) until we complete Forward Pass. 
-    *   -And we want to avoid dead sym clean up (in this case, scope object though not explicitly live, it is live implicitly) during Block merging in the forward pass. 
+    *   -We do not know detailed information about Heap arguments obj syms(aliasing etc.) until we complete Forward Pass.
+    *   -And we want to avoid dead sym clean up (in this case, scope object though not explicitly live, it is live implicitly) during Block merging in the forward pass.
     *   -Hence this is the optimal spot to do this.
     */
 
@@ -3196,10 +3196,10 @@ bool
 BackwardPass::IsFormalParamSym(Func * func, Sym * sym) const
 {
     Assert(sym);
-    
+
     if (sym->IsPropertySym())
     {
-        //If the sym is a propertySym, then see if the propertyId is within the range of the formals 
+        //If the sym is a propertySym, then see if the propertyId is within the range of the formals
         //We can have other properties stored in the scope object other than the formals (following the formals).
         PropertySym * propSym = sym->AsPropertySym();
         IntConstType    value = propSym->m_propertyId;
@@ -4250,8 +4250,8 @@ bool
 BackwardPass::ProcessSymUse(Sym * sym, bool isRegOpndUse, BOOLEAN isNonByteCodeUse)
 {
     BasicBlock * block = this->currentBlock;
-    
-    if (CanDeadStoreInstrForScopeObjRemoval(sym))   
+
+    if (CanDeadStoreInstrForScopeObjRemoval(sym))
     {
         return false;
     }
@@ -4537,7 +4537,7 @@ BackwardPass::TrackObjTypeSpecProperties(IR::PropertySymOpnd *opnd, BasicBlock *
                     }
                     bucket->SetMonoGuardType(nullptr);
                 }
-                
+
                 if (!opnd->IsTypeAvailable())
                 {
                     // Stop tracking the guarded properties if there's not another type check upstream.
@@ -5651,7 +5651,7 @@ BackwardPass::TrackIntUsage(IR::Instr *const instr)
                     SetNegativeZeroDoesNotMatterIfLastUse(instr->GetSrc2());
                     break;
                 }
-                
+
                 // -0 + -0 == -0. As long as one src is guaranteed to not be -0, -0 does not matter for the other src. Pick a
                 // src for which to ignore negative zero, based on which sym is last-use. If both syms are last-use, src2 is
                 // picked arbitrarily.
@@ -6741,9 +6741,9 @@ BackwardPass::DeadStoreInstr(IR::Instr *instr)
         tempBv.Copy(this->currentBlock->byteCodeUpwardExposedUsed);
 #endif
         PropertySym *unusedPropertySym = nullptr;
-        
+
         GlobOpt::TrackByteCodeSymUsed(instr, this->currentBlock->byteCodeUpwardExposedUsed, &unusedPropertySym);
-        
+
 #if DBG
         BVSparse<JitArenaAllocator> tempBv2(this->tempAlloc);
         tempBv2.Copy(this->currentBlock->byteCodeUpwardExposedUsed);
@@ -6781,7 +6781,7 @@ BackwardPass::DeadStoreInstr(IR::Instr *instr)
     }
 #endif
 
-    
+
     if (instr->m_opcode == Js::OpCode::ArgIn_A)
     {
         //Ignore tracking ArgIn for "this", as argInsCount only tracks other params - unless it is a asmjs function(which doesn't have a "this").
@@ -6793,7 +6793,7 @@ BackwardPass::DeadStoreInstr(IR::Instr *instr)
     }
 
     TraceDeadStoreOfInstrsForScopeObjectRemoval();
-    
+
     block->RemoveInstr(instr);
     return true;
 }

+ 1 - 1
lib/Backend/Encoder.cpp

@@ -788,7 +788,7 @@ Encoder::Encode()
         {
             __analysis_assume(m_instrNumber < instrCount);
             instr->DumpGlobOptInstrString();
-#ifdef _WIN64
+#ifdef TARGET_64
             Output::Print(_u("%12IX  "), m_offsetBuffer[m_instrNumber++] + (BYTE *)m_func->GetJITOutput()->GetCodeAddress());
 #else
             Output::Print(_u("%8IX  "), m_offsetBuffer[m_instrNumber++] + (BYTE *)m_func->GetJITOutput()->GetCodeAddress());

+ 1 - 1
lib/Common/CommonDefines.h

@@ -294,7 +294,7 @@
 #endif
 
 // ToDo (SaAgarwa): Disable VirtualTypedArray on ARM64 till we make sure it works correctly
-#if _WIN64 && !defined(_M_ARM64)
+#if defined(_WIN32) && defined(TARGET_64) && !defined(_M_ARM64)
 #define ENABLE_FAST_ARRAYBUFFER 1
 #endif
 #endif

+ 4 - 4
lib/Common/CommonPal.h

@@ -332,11 +332,11 @@ typedef struct _SINGLE_LIST_ENTRY {
   struct _SINGLE_LIST_ENTRY *Next;
 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
 
-#if defined(_WIN64)
+#if defined(TARGET_64)
 
 //
 // The type SINGLE_LIST_ENTRY is not suitable for use with SLISTs.  For
-// WIN64, an entry on an SLIST is required to be 16-byte aligned, while a
+// TARGET_64, an entry on an SLIST is required to be 16-byte aligned, while a
 // SINGLE_LIST_ENTRY structure has only 8 byte alignment.
 //
 // Therefore, all SLIST code should use the SLIST_ENTRY type instead of the
@@ -352,11 +352,11 @@ typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
 
 #pragma warning(pop)
 
-#else
+#else // defined(TARGET_64)
 
 typedef struct _SINGLE_LIST_ENTRY SLIST_ENTRY, *PSLIST_ENTRY;
 
-#endif // _WIN64
+#endif // defined(TARGET_64)
 
 #if defined(_AMD64_)
 

+ 2 - 2
lib/Common/Core/SysInfo.h

@@ -69,7 +69,7 @@ public:
 #ifdef STACK_ALIGN
     static DWORD const StackAlign = STACK_ALIGN;
 #else
-# if defined(_WIN64)
+# if defined(TARGET_64)
     static DWORD const StackAlign = 16;
 # elif defined(_M_ARM)
     static DWORD const StackAlign = 8;
@@ -84,7 +84,7 @@ public:
     UINT_PTR dllLoadAddress;
     UINT_PTR dllHighAddress;
 #endif
-    
+
 private:
     AutoSystemInfo() : majorVersion(0), minorVersion(0), buildDateHash(0), buildTimeHash(0), crtSize(0) { Initialize(); }
     void Initialize();

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

@@ -65,7 +65,7 @@ struct DefaultComparer<size_t>
 
     inline static hash_t GetHashCode(size_t i)
     {
-#if _WIN64
+#ifdef TARGET_64
         // For 64 bits we want all 64 bits of the pointer to be represented in the hash code.
         uint32 hi = ((UINT_PTR) i >> 32);
         uint32 lo = (uint32) (i & 0xFFFFFFFF);

+ 2 - 2
lib/Common/Memory/MarkContext.inl

@@ -23,7 +23,7 @@ bool MarkContext::AddMarkedObject(void * objectAddress, size_t objectSize)
 
     MarkCandidate markCandidate;
 
-#if defined(_WIN64) && defined(_M_X64)
+#if defined(_WIN32) && defined(_M_X64)
     // Enabling store forwards. The intrinsic generates stores matching the load in size.
     // This enables skipping caches and forwarding the store data to the following load.
     *(__m128i *)&markCandidate = _mm_set_epi64x(objectSize, (__int64)objectAddress);
@@ -245,7 +245,7 @@ void MarkContext::ProcessMark()
             }
 #endif
         }
-        
+
         Assert(markStack.IsEmpty());
 
 #ifdef RECYCLER_VISITED_HOST

+ 3 - 3
lib/Common/Memory/RecyclerWriteBarrierManager.cpp

@@ -67,12 +67,12 @@ X64WriteBarrierCardTableManager::OnThreadInit()
     VirtualQuery((LPCVOID)teb->StackLimit, &memInfo, sizeof(memInfo));
     Assert((char*)memInfo.AllocationBase == stackEnd);
     Assert(memInfo.AllocationProtect == PAGE_READWRITE);
-#endif
-#else
+#endif // DBG
+#else // defined(_WIN32) && defined(_M_X64) && !defined(_M_ARM64)
     ULONG_PTR stackBase = 0;
     ULONG_PTR stackEnd = 0;
     ::GetCurrentThreadStackLimits(&stackEnd, &stackBase);
-#endif
+#endif // defined(_WIN32) && defined(_M_X64) && !defined(_M_ARM64)
 
 #ifdef X64_WB_DIAG
     this->_stackbase = (char*)stackBase;

+ 2 - 2
lib/Parser/errstr.cpp

@@ -94,7 +94,7 @@ static BOOL FGetStringFromLibrary(HMODULE hlib, int istring, __out_ecount(cchMax
 
 LError:
 
-#if !_WIN32 && !_WIN64
+#if !defined(_WIN32)
 
     //
     // Unlock/FreeResource non-essential on win32/64.
@@ -106,7 +106,7 @@ LError:
         FreeResource(hgl);
     }
 
-#endif
+#endif // !defined(_WIN32)
 #endif // ENABLE_GLOBALIZATION
     return fRet;
 }

+ 2 - 2
lib/Parser/screrror.cpp

@@ -111,7 +111,7 @@ const MHR g_rgmhr[] =
     /*0x800401F5*/ MAPHR(CO_E_APPNOTFOUND, VBSERR_CantCreateObject),
     /*0x800401FE*/ MAPHR(CO_E_APPDIDNTREG, VBSERR_CantCreateObject),
 
-#if _WIN32 || _WIN64
+#if _WIN32
     // FACILITY_WIN32 errors
     /*0x80070005*/ MAPHR(E_ACCESSDENIED, VBSERR_PermissionDenied),
     /*0x8007000E*/ MAPHR(E_OUTOFMEMORY, VBSERR_OutOfMemory),
@@ -120,7 +120,7 @@ const MHR g_rgmhr[] =
 
     // FACILITY_WINDOWS
     /*0x80080005*/ MAPHR(CO_E_SERVER_EXEC_FAILURE, VBSERR_CantCreateObject),
-#endif // _WIN32 || _WIN64
+#endif // _WIN32
 };
 const int32 kcmhr = sizeof(g_rgmhr) / sizeof(g_rgmhr[0]);
 

+ 1 - 1
lib/Runtime/Library/ArrayBuffer.h

@@ -166,7 +166,7 @@ namespace Js
         static int GetBufferOffset() { return offsetof(ArrayBuffer, buffer); }
 
         virtual void AddParent(ArrayBufferParent* parent) override;
-#if _WIN64
+#if defined(TARGET_64)
         //maximum 2G -1  for amd64
         static const uint32 MaxArrayBufferLength = 0x7FFFFFFF;
 #else

+ 2 - 2
lib/Runtime/Library/SharedArrayBuffer.h

@@ -42,7 +42,7 @@ namespace Js
 #if DBG
             , allowedAgents(nullptr)
 #endif
-        { 
+        {
         }
     };
 
@@ -89,7 +89,7 @@ namespace Js
         WaiterList *GetWaiterList(uint index);
         SharedContents *GetSharedContents() { return sharedContents; }
 
-#if _WIN64
+#if defined(TARGET_64)
         //maximum 2G -1  for amd64
         static const uint32 MaxSharedArrayBufferLength = 0x7FFFFFFF;
 #else