Skip to content

Commit

Permalink
Sync flags with debugger library code
Browse files Browse the repository at this point in the history
- see nanoframework/nf-debugger#24

Signed-off-by: José Simões <jose.simoes@eclo.solutions>
  • Loading branch information
josesimoes committed Jun 14, 2017
1 parent b8c9fce commit 03fe9e9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
14 changes: 7 additions & 7 deletions src/CLR/Core/Execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void CLR_RT_ExecutionEngine::LoadDownloadedAssemblies()
//
// For those assemblies that failed to load (missing dependency?), clean up.
//
if((pASSM->m_flags & CLR_RT_Assembly::c_ResolutionCompleted) == 0)
if((pASSM->m_flags & CLR_RT_Assembly::ResolutionCompleted) == 0)
{
pASSM->m_pFile = NULL;

Expand Down Expand Up @@ -807,7 +807,7 @@ bool CLR_RT_ExecutionEngine::SpawnStaticConstructorHelper( CLR_RT_AppDomain* app
}
}

appDomainAssembly->m_flags |= CLR_RT_AppDomainAssembly::c_StaticConstructorsExecuted;
appDomainAssembly->m_flags |= CLR_RT_AppDomainAssembly::StaticConstructorsExecuted;
return false;
}

Expand Down Expand Up @@ -853,7 +853,7 @@ void CLR_RT_ExecutionEngine::SpawnStaticConstructor( CLR_RT_Thread *&pCctorThrea
CLR_RT_Assembly* assembly = appDomainAssembly->m_assembly;

//Find an AppDomainAssembly that does not have it's static constructor bit set...
if((appDomainAssembly->m_flags & CLR_RT_AppDomainAssembly::c_StaticConstructorsExecuted) == 0)
if((appDomainAssembly->m_flags & CLR_RT_AppDomainAssembly::StaticConstructorsExecuted) == 0)
{
CLR_RT_MethodDef_Index idx; idx.Set( assembly->m_idx, 0 );

Expand All @@ -866,7 +866,7 @@ void CLR_RT_ExecutionEngine::SpawnStaticConstructor( CLR_RT_Thread *&pCctorThrea
CLR_RT_AppDomainAssembly* appDomainAssemblyRef = appDomain->FindAppDomainAssembly(ar->m_target);

_ASSERTE(appDomainAssemblyRef != NULL);
_ASSERTE(appDomainAssemblyRef->m_flags & CLR_RT_AppDomainAssembly::c_StaticConstructorsExecuted);
_ASSERTE(appDomainAssemblyRef->m_flags & CLR_RT_AppDomainAssembly::StaticConstructorsExecuted);
}
#endif

Expand Down Expand Up @@ -919,7 +919,7 @@ bool CLR_RT_ExecutionEngine::SpawnStaticConstructorHelper( CLR_RT_Assembly* asse
}
}

assembly->m_flags |= CLR_RT_Assembly::c_StaticConstructorsExecuted;
assembly->m_flags |= CLR_RT_Assembly::StaticConstructorsExecuted;
return false;
}

Expand Down Expand Up @@ -954,7 +954,7 @@ void CLR_RT_ExecutionEngine::SpawnStaticConstructor( CLR_RT_Thread *&pCctorThrea
NANOCLR_FOREACH_ASSEMBLY(g_CLR_RT_TypeSystem)
{
//Find an AppDomainAssembly that does not have it's static constructor bit set...
if((pASSM->m_flags & CLR_RT_Assembly::c_StaticConstructorsExecuted) == 0)
if((pASSM->m_flags & CLR_RT_Assembly::StaticConstructorsExecuted) == 0)
{
CLR_RT_MethodDef_Index idx; idx.Set( pASSM->m_idx, 0 );
bool fDepedenciesRun = true;
Expand All @@ -963,7 +963,7 @@ void CLR_RT_ExecutionEngine::SpawnStaticConstructor( CLR_RT_Thread *&pCctorThrea
CLR_RT_AssemblyRef_CrossReference* ar = pASSM->m_pCrossReference_AssemblyRef;
for(int i=0; i<pASSM->m_pTablesSize[ TBL_AssemblyRef ]; i++, ar++)
{
if((ar->m_target->m_flags & CLR_RT_Assembly::c_StaticConstructorsExecuted) == 0)
if((ar->m_target->m_flags & CLR_RT_Assembly::StaticConstructorsExecuted) == 0)
{
fDepedenciesRun = true;
break;
Expand Down
18 changes: 9 additions & 9 deletions src/CLR/Core/TypeSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,7 @@ bool CLR_RT_Assembly::Resolve_AssemblyRef( bool fOutput )

CLR_RT_Assembly* target = g_CLR_RT_TypeSystem.FindAssembly( szName, &src->version, fExact );

if(target == NULL || (target->m_flags & CLR_RT_Assembly::c_Resolved) == 0)
if(target == NULL || (target->m_flags & CLR_RT_Assembly::Resolved) == 0)
{
#if !defined(BUILD_RTM)
if(fOutput)
Expand Down Expand Up @@ -2839,19 +2839,19 @@ HRESULT CLR_RT_Assembly::PrepareForExecution()
NATIVE_PROFILE_CLR_CORE();
NANOCLR_HEADER();

if((m_flags & CLR_RT_Assembly::c_PreparingForExecution) != 0)
if((m_flags & CLR_RT_Assembly::PreparingForExecution) != 0)
{
//Circular dependency
_ASSERTE(false);

NANOCLR_MSG_SET_AND_LEAVE(CLR_E_FAIL, L"Failed to prepare type system for execution\n");
}

if((m_flags & CLR_RT_Assembly::c_PreparedForExecution) == 0)
if((m_flags & CLR_RT_Assembly::PreparedForExecution) == 0)
{
int i;

m_flags |= CLR_RT_Assembly::c_PreparingForExecution;
m_flags |= CLR_RT_Assembly::PreparingForExecution;

ITERATE_THROUGH_RECORDS(this,i,AssemblyRef,ASSEMBLYREF)
{
Expand Down Expand Up @@ -2886,8 +2886,8 @@ HRESULT CLR_RT_Assembly::PrepareForExecution()
NANOCLR_CLEANUP();

//Only try once. If this fails, then what?
m_flags |= CLR_RT_Assembly::c_PreparedForExecution;
m_flags &= ~CLR_RT_Assembly::c_PreparingForExecution;
m_flags |= CLR_RT_Assembly::PreparedForExecution;
m_flags &= ~CLR_RT_Assembly::PreparingForExecution;

NANOCLR_CLEANUP_END();
}
Expand Down Expand Up @@ -3696,15 +3696,15 @@ HRESULT CLR_RT_TypeSystem::ResolveAll()

NANOCLR_FOREACH_ASSEMBLY(*this)
{
if((pASSM->m_flags & CLR_RT_Assembly::c_Resolved) == 0)
if((pASSM->m_flags & CLR_RT_Assembly::Resolved) == 0)
{
fNeedResolution = true;

if(pASSM->Resolve_AssemblyRef( fOutput ))
{
fGot = true;

pASSM->m_flags |= CLR_RT_Assembly::c_Resolved;
pASSM->m_flags |= CLR_RT_Assembly::Resolved;

NANOCLR_CHECK_HRESULT(pASSM->Resolve_TypeRef ());
NANOCLR_CHECK_HRESULT(pASSM->Resolve_FieldRef ());
Expand All @@ -3718,7 +3718,7 @@ HRESULT CLR_RT_TypeSystem::ResolveAll()
NANOCLR_CHECK_HRESULT(pASSM->Resolve_AllocateStaticFields( pASSM->m_pStaticFields ));
#endif

pASSM->m_flags |= CLR_RT_Assembly::c_ResolutionCompleted;
pASSM->m_flags |= CLR_RT_Assembly::ResolutionCompleted;
}
}
}
Expand Down
20 changes: 12 additions & 8 deletions src/CLR/Include/nanoCLR_Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,18 +896,22 @@ struct CLR_RT_Assembly : public CLR_RT_HeapBlock_Node // EVENT HEAP - NO RELOCAT

//--//

static const CLR_UINT32 c_Resolved = 0x00000001;
static const CLR_UINT32 c_ResolutionCompleted = 0x00000002;
static const CLR_UINT32 c_PreparedForExecution = 0x00000004;
static const CLR_UINT32 c_Deployed = 0x00000008;
static const CLR_UINT32 c_PreparingForExecution = 0x00000010;
static const CLR_UINT32 c_StaticConstructorsExecuted = 0x00000020;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NEED TO KEEP THESE IN SYNC WITH Enum 'Commands.DebuggingResolveAssembly.ResolvedStatus' on debugger library code //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static const CLR_UINT32 Resolved = 0x00000001;
static const CLR_UINT32 ResolutionCompleted = 0x00000002;
static const CLR_UINT32 PreparedForExecution = 0x00000004;
static const CLR_UINT32 Deployed = 0x00000008;
static const CLR_UINT32 PreparingForExecution = 0x00000010;
static const CLR_UINT32 StaticConstructorsExecuted = 0x00000020;

CLR_UINT32 m_idx; // Relative to the type system (for static fields access).
CLR_UINT32 m_flags;

const CLR_RECORD_ASSEMBLY* m_header; // ANY HEAP - DO RELOCATION -
const char* m_szName; // ANY HEAP - DO RELOCATION -
const char* m_szName; // ANY HEAP - DO RELOCATION -

const CLR_RT_MethodHandler* m_nativeCode;

Expand Down Expand Up @@ -1146,7 +1150,7 @@ struct CLR_RT_AppDomain : public CLR_RT_ObjectToEvent_Destination // EVENT HEAP

struct CLR_RT_AppDomainAssembly : public CLR_RT_HeapBlock_Node //EVENT HEAP - NO RELOCATION -
{
static const CLR_UINT32 c_StaticConstructorsExecuted = 0x00000001;
static const CLR_UINT32 StaticConstructorsExecuted = 0x00000001;

CLR_UINT32 m_flags;
CLR_RT_AppDomain* m_appDomain; // EVENT HEAP - NO RELOCATION -
Expand Down
2 changes: 1 addition & 1 deletion targets/CMSIS-OS/ChibiOS/nanoCLR/CLRStartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ struct Settings
{
break;
}
assm->m_flags |= CLR_RT_Assembly::c_Deployed;
assm->m_flags |= CLR_RT_Assembly::Deployed;
}

NANOCLR_NOCLEANUP();
Expand Down
2 changes: 1 addition & 1 deletion targets/os/win32/nanoCLR/CLRStartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ struct Settings
if(!isXIP) CLR_RT_Memory::Release( assembliesBuffer );
break;
}
assm->m_flags |= CLR_RT_Assembly::c_Deployed;
assm->m_flags |= CLR_RT_Assembly::Deployed;
}
if(!isXIP) CLR_RT_Memory::Release( headerBuffer );

Expand Down

0 comments on commit 03fe9e9

Please sign in to comment.