Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build fixes for ARM
Browse files Browse the repository at this point in the history
noahfalk committed Jun 24, 2017
1 parent a513501 commit 4725e32
Showing 6 changed files with 47 additions and 15 deletions.
1 change: 1 addition & 0 deletions clr.defines.targets
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
<DefineConstants Condition="'$(FeatureHosting)' == 'true'">$(DefineConstants);FEATURE_HOSTING</DefineConstants>
<DefineConstants Condition="'$(FeatureImplicitLongPath)' == 'true'">$(DefineConstants);FEATURE_IMPLICIT_LONGPATH</DefineConstants>
<DefineConstants Condition="'$(FeatureIsolatedStorageQuotaEnforcement)' == 'true'">$(DefineConstants);FEATURE_ISOLATED_STORAGE_QUOTA_ENFORCEMENT</DefineConstants>
<DefineConstants Condition="'$(FeatureJumpStamp)' == 'true'">$(DefineConstants);FEATURE_JUMPSTAMP</DefineConstants>
<DefineConstants Condition="'$(FeatureMacl)' == 'true'">$(DefineConstants);FEATURE_MACL</DefineConstants>
<DefineConstants Condition="'$(FeatureManagedEtw)' == 'true'">$(DefineConstants);FEATURE_MANAGED_ETW</DefineConstants>
<DefineConstants Condition="'$(FeatureManagedEtwChannels)' == 'true'">$(DefineConstants);FEATURE_MANAGED_ETW_CHANNELS</DefineConstants>
5 changes: 4 additions & 1 deletion clrdefinitions.cmake
Original file line number Diff line number Diff line change
@@ -119,7 +119,6 @@ endif(CLR_CMAKE_PLATFORM_LINUX)
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
endif(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_TIERED_COMPILATION)
# NetBSD doesn't implement this feature
if(NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
add_definitions(-DFEATURE_HIJACK)
@@ -136,6 +135,9 @@ if(FEATURE_INTERPRETER)
add_definitions(-DFEATURE_INTERPRETER)
endif(FEATURE_INTERPRETER)
add_definitions(-DFEATURE_ISYM_READER)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
add_definitions(-DFEATURE_JUMPSTAMP)
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
add_definitions(-DFEATURE_LOADER_OPTIMIZATION)
if (CLR_CMAKE_PLATFORM_LINUX OR WIN32)
add_definitions(-DFEATURE_MANAGED_ETW)
@@ -175,6 +177,7 @@ if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
endif ()
add_definitions(-DFEATURE_SVR_GC)
add_definitions(-DFEATURE_SYMDIFF)
add_definitions(-DFEATURE_TIERED_COMPILATION)
if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
# Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)
24 changes: 21 additions & 3 deletions src/vm/codeversion.cpp
Original file line number Diff line number Diff line change
@@ -983,7 +983,9 @@ MethodDescVersioningState::MethodDescVersioningState(PTR_MethodDesc pMethodDesc)
m_pFirstVersionNode(dac_cast<PTR_NativeCodeVersionNode>(nullptr))
{
LIMITED_METHOD_DAC_CONTRACT;
#ifdef FEATURE_JUMPSTAMP
ZeroMemory(m_rgSavedCode, JumpStubSize);
#endif
}

PTR_MethodDesc MethodDescVersioningState::GetMethodDesc() const
@@ -1006,6 +1008,7 @@ PTR_NativeCodeVersionNode MethodDescVersioningState::GetFirstVersionNode() const
return m_pFirstVersionNode;
}

#ifdef FEATURE_JUMPSTAMP
MethodDescVersioningState::JumpStampFlags MethodDescVersioningState::GetJumpStampState()
{
LIMITED_METHOD_DAC_CONTRACT;
@@ -1018,7 +1021,7 @@ void MethodDescVersioningState::SetJumpStampState(JumpStampFlags newState)
LIMITED_METHOD_CONTRACT;
m_flags = (m_flags & ~JumpStampMask) | (BYTE)newState;
}
#endif
#endif // DACCESS_COMPILE

#ifndef DACCESS_COMPILE
HRESULT MethodDescVersioningState::SyncJumpStamp(NativeCodeVersion nativeCodeVersion, BOOL fEESuspended)
@@ -1058,7 +1061,7 @@ HRESULT MethodDescVersioningState::SyncJumpStamp(NativeCodeVersion nativeCodeVer
}
}
}
#endif
#endif // DACCESS_COMPILE

//---------------------------------------------------------------------------------------
//
@@ -1106,6 +1109,7 @@ LPBYTE FirstCodeByteAddr(LPBYTE pbCode, DebuggerControllerPatch * dbgpatch)


#ifdef _DEBUG
#ifndef DACCESS_COMPILE
BOOL MethodDescVersioningState::CodeIsSaved()
{
LIMITED_METHOD_CONTRACT;
@@ -1117,6 +1121,7 @@ BOOL MethodDescVersioningState::CodeIsSaved()
}
return FALSE;
}
#endif //DACCESS_COMPILE
#endif //_DEBUG

//---------------------------------------------------------------------------------------
@@ -1554,6 +1559,7 @@ HRESULT MethodDescVersioningState::UpdateJumpStampHelper(BYTE* pbCode, INT64 i64
#endif // _X86_ || _AMD64_
}
#endif
#endif // FEATURE_JUMPSTAMP

BOOL MethodDescVersioningState::IsDefaultVersionActiveChild() const
{
@@ -1835,7 +1841,7 @@ ILCodeVersion CodeVersionManager::GetILCodeVersion(PTR_MethodDesc pMethod, ReJIT
return ILCodeVersion();
#else // FEATURE_REJIT
_ASSERTE(rejitId == 0);
return ILCodeVersion(pModule, methodDef);
return ILCodeVersion(dac_cast<PTR_Module>(pMethod->GetModule()), pMethod->GetMemberDef());
#endif // FEATURE_REJIT
}

@@ -2181,13 +2187,19 @@ HRESULT CodeVersionManager::PublishNativeCodeVersion(MethodDesc* pMethod, Native
}
else
{
#ifndef FEATURE_JUMPSTAMP
_ASSERTE(!"This platform doesn't support JumpStamp but this method doesn't version with Precode,"
" this method can't be updated");
return E_FAIL;
#else
MethodDescVersioningState* pVersioningState;
if (FAILED(hr = GetOrCreateMethodDescVersioningState(pMethod, &pVersioningState)))
{
_ASSERTE(hr == E_OUTOFMEMORY);
return hr;
}
return pVersioningState->SyncJumpStamp(nativeCodeVersion, fEESuspended);
#endif
}
}

@@ -2456,6 +2468,10 @@ HRESULT CodeVersionManager::DoJumpStampIfNecessary(MethodDesc* pMD, PCODE pCode)
return GetNonVersionableError(pMD);
}

#ifndef FEATURE_JUMPSTAMP
_ASSERTE(!"How did we get here? IsVersionableWithJumpStamp() should have been FALSE above");
return S_OK;
#else
MethodDescVersioningState* pVersioningState;
if (FAILED(hr = GetOrCreateMethodDescVersioningState(pMD, &pVersioningState)))
{
@@ -2468,6 +2484,8 @@ HRESULT CodeVersionManager::DoJumpStampIfNecessary(MethodDesc* pMD, PCODE pCode)
return S_OK;
}
return pVersioningState->JumpStampNativeCode(pCode);
#endif // FEATURE_JUMPSTAMP

}
#endif // DACCESS_COMPILE

16 changes: 12 additions & 4 deletions src/vm/codeversion.h
Original file line number Diff line number Diff line change
@@ -399,27 +399,31 @@ class MethodDescVersioningState
{
public:
// The size of the code used to jump stamp the prolog
#ifdef FEATURE_JUMPSTAMP
static const size_t JumpStubSize =
#if defined(_X86_) || defined(_AMD64_)
5;
#else
#error "Need to define size of rejit jump-stamp for this platform"
1;
#error "Need to define size of jump-stamp for this platform"
#endif
#endif // FEATURE_JUMPSTAMP

MethodDescVersioningState(PTR_MethodDesc pMethodDesc);
PTR_MethodDesc GetMethodDesc() const;
NativeCodeVersionId AllocateVersionId();
PTR_NativeCodeVersionNode GetFirstVersionNode() const;

#ifndef DACCESS_COMPILE
#ifdef FEATURE_JUMPSTAMP
HRESULT SyncJumpStamp(NativeCodeVersion nativeCodeVersion, BOOL fEESuspended);
HRESULT UpdateJumpTarget(BOOL fEESuspended, PCODE pRejittedCode);
HRESULT UndoJumpStampNativeCode(BOOL fEESuspended);
HRESULT JumpStampNativeCode(PCODE pCode = NULL);
#endif // FEATURE_JUMPSTAMP
void LinkNativeCodeVersionNode(NativeCodeVersionNode* pNativeCodeVersionNode);
#endif
#endif // DACCESS_COMPILE

#ifdef FEATURE_JUMPSTAMP
enum JumpStampFlags
{
// There is no jump stamp in place on this method (Either because
@@ -437,6 +441,7 @@ class MethodDescVersioningState

JumpStampFlags GetJumpStampState();
void SetJumpStampState(JumpStampFlags newState);
#endif // FEATURE_JUMPSTAMP

//read-write data for the default native code version
BOOL IsDefaultVersionActiveChild() const;
@@ -445,8 +450,8 @@ class MethodDescVersioningState
#endif

private:
#if !defined(DACCESS_COMPILE) && defined(FEATURE_JUMPSTAMP)
INDEBUG(BOOL CodeIsSaved();)
#ifndef DACCESS_COMPILE
HRESULT UpdateJumpStampHelper(BYTE* pbCode, INT64 i64OldValue, INT64 i64NewValue, BOOL fContentionPossible);
#endif
PTR_MethodDesc m_pMethodDesc;
@@ -460,8 +465,11 @@ class MethodDescVersioningState
NativeCodeVersionId m_nextId;
PTR_NativeCodeVersionNode m_pFirstVersionNode;


// The originally JITted code that was overwritten with the jmp stamp.
#ifdef FEATURE_JUMPSTAMP
BYTE m_rgSavedCode[JumpStubSize];
#endif
};

class MethodDescVersioningStateHashTraits : public NoRemoveSHashTraits<DefaultSHashTraits<PTR_MethodDescVersioningState>>
12 changes: 9 additions & 3 deletions src/vm/method.hpp
Original file line number Diff line number Diff line change
@@ -1286,7 +1286,7 @@ class MethodDesc
public:

// TRUE iff it is possible to change the code this method will run using
// the MethodCodeVersioningManager.
// the CodeVersionManager.
// Note: EnC currently returns FALSE here because it uses its own seperate
// scheme to manage versionability. We will likely want to converge them
// at some point.
@@ -1302,8 +1302,14 @@ class MethodDesc
if (IsUnboxingStub() || IsInstantiatingStub())
return FALSE;

return TRUE;
#ifndef FEATURE_JUMPSTAMP
// if we don't support jumpstamps then only the methods that support precodes are versionable
if (!IsVersionableWithPrecode())
return FALSE;
#endif

return TRUE;
#endif // FEATURE_CODE_VERSIONING
}

// Of the methods where IsVersionable() == TRUE, these methods switch between
@@ -1333,7 +1339,7 @@ class MethodDesc
// If IsVersionable() == FALSE, undefined
BOOL IsVersionableWithJumpStamp()
{
#ifdef FEATURE_CODE_VERSIONING
#if defined(FEATURE_CODE_VERSIONING) && defined(FEATURE_JUMPSTAMP)
return !IsVersionableWithPrecode();
#else
return FALSE;
4 changes: 0 additions & 4 deletions src/vm/rejit.cpp
Original file line number Diff line number Diff line change
@@ -1060,10 +1060,6 @@ HRESULT ReJitManager::RequestRevert(
return E_NOTIMPL;
}

void ReJitManager::PreInit(BOOL fSharedDomain)
{
}

ReJITID ReJitManager::GetReJitId(PTR_MethodDesc pMD, PCODE pCodeStart)
{
return 0;

0 comments on commit 4725e32

Please sign in to comment.