From 81a241a09db670cae8b2e38673845e6959353ad2 Mon Sep 17 00:00:00 2001 From: Oguz Bastemur Date: Thu, 25 Jan 2018 15:44:11 -0800 Subject: [PATCH] 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 --- lib/Backend/BackwardPass.cpp | 40 +++++++++---------- lib/Backend/Encoder.cpp | 2 +- lib/Common/CommonDefines.h | 2 +- lib/Common/CommonPal.h | 8 ++-- lib/Common/Core/SysInfo.h | 4 +- lib/Common/DataStructures/Comparer.h | 2 +- lib/Common/Memory/MarkContext.inl | 4 +- .../Memory/RecyclerWriteBarrierManager.cpp | 6 +-- lib/Parser/errstr.cpp | 4 +- lib/Parser/screrror.cpp | 4 +- lib/Runtime/Library/ArrayBuffer.h | 2 +- lib/Runtime/Library/SharedArrayBuffer.h | 4 +- 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/Backend/BackwardPass.cpp b/lib/Backend/BackwardPass.cpp index ae70460d9f5..949c8c572e9 100644 --- a/lib/Backend/BackwardPass.cpp +++ b/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, BVSparsecurrentInstr = 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: { // = GetCachedFunc , - // is converted to + // is converted to // = NewScFunc , 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 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; } diff --git a/lib/Backend/Encoder.cpp b/lib/Backend/Encoder.cpp index 503d14b0ba7..d6a700817b7 100644 --- a/lib/Backend/Encoder.cpp +++ b/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()); diff --git a/lib/Common/CommonDefines.h b/lib/Common/CommonDefines.h index a85c5262f13..5b915422074 100644 --- a/lib/Common/CommonDefines.h +++ b/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 diff --git a/lib/Common/CommonPal.h b/lib/Common/CommonPal.h index 54419e2af49..17ed6d3bc4b 100644 --- a/lib/Common/CommonPal.h +++ b/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_) diff --git a/lib/Common/Core/SysInfo.h b/lib/Common/Core/SysInfo.h index aee010be961..f709d44360b 100644 --- a/lib/Common/Core/SysInfo.h +++ b/lib/Common/Core/SysInfo.h @@ -69,7 +69,7 @@ class AutoSystemInfo : public SYSTEM_INFO #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 @@ class AutoSystemInfo : public SYSTEM_INFO UINT_PTR dllLoadAddress; UINT_PTR dllHighAddress; #endif - + private: AutoSystemInfo() : majorVersion(0), minorVersion(0), buildDateHash(0), buildTimeHash(0), crtSize(0) { Initialize(); } void Initialize(); diff --git a/lib/Common/DataStructures/Comparer.h b/lib/Common/DataStructures/Comparer.h index 9b2e1a95ad7..aed91e24324 100644 --- a/lib/Common/DataStructures/Comparer.h +++ b/lib/Common/DataStructures/Comparer.h @@ -65,7 +65,7 @@ struct DefaultComparer 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); diff --git a/lib/Common/Memory/MarkContext.inl b/lib/Common/Memory/MarkContext.inl index 9d1885136de..3a58fb5545b 100644 --- a/lib/Common/Memory/MarkContext.inl +++ b/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 diff --git a/lib/Common/Memory/RecyclerWriteBarrierManager.cpp b/lib/Common/Memory/RecyclerWriteBarrierManager.cpp index 440fee7652f..9b98df9e224 100644 --- a/lib/Common/Memory/RecyclerWriteBarrierManager.cpp +++ b/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; diff --git a/lib/Parser/errstr.cpp b/lib/Parser/errstr.cpp index 869e590b2b6..c57e64d7c87 100644 --- a/lib/Parser/errstr.cpp +++ b/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 @@ static BOOL FGetStringFromLibrary(HMODULE hlib, int istring, __out_ecount(cchMax FreeResource(hgl); } -#endif +#endif // !defined(_WIN32) #endif // ENABLE_GLOBALIZATION return fRet; } diff --git a/lib/Parser/screrror.cpp b/lib/Parser/screrror.cpp index cb752d56c2f..04c1032bb21 100644 --- a/lib/Parser/screrror.cpp +++ b/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]); diff --git a/lib/Runtime/Library/ArrayBuffer.h b/lib/Runtime/Library/ArrayBuffer.h index 5f9a1896e28..49d5ba262c1 100644 --- a/lib/Runtime/Library/ArrayBuffer.h +++ b/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 diff --git a/lib/Runtime/Library/SharedArrayBuffer.h b/lib/Runtime/Library/SharedArrayBuffer.h index 6d0efd3d83f..cf821e7a31d 100644 --- a/lib/Runtime/Library/SharedArrayBuffer.h +++ b/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