1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Changed ProgramStart/ProgramEnd to ensure StaticInits get called

This commit is contained in:
Brian Fiete 2019-10-17 05:31:57 -07:00
parent 07b993d824
commit 7882632e93
6 changed files with 19 additions and 19 deletions

View file

@ -118,9 +118,6 @@ namespace IDE.Debugger
[StdCall,CLink] [StdCall,CLink]
static extern void Debugger_Delete(); static extern void Debugger_Delete();
[StdCall,CLink]
static extern void Debugger_ProgramDone();
[StdCall,CLink] [StdCall,CLink]
static extern int32 Debugger_GetAddrSize(); static extern int32 Debugger_GetAddrSize();
@ -398,11 +395,6 @@ namespace IDE.Debugger
Debugger_LoadDebugVisualizers(fileName); Debugger_LoadDebugVisualizers(fileName);
} }
public static void ProgramDone()
{
Debugger_ProgramDone();
}
public void FullReportMemory() public void FullReportMemory()
{ {
Debugger_FullReportMemory(); Debugger_FullReportMemory();

View file

@ -498,12 +498,19 @@ namespace IDE
} }
} }
[StdCall,CLink]
static extern void IDEHelper_ProgramStart();
[StdCall,CLink]
static extern void IDEHelper_ProgramDone();
public this() public this()
{ {
sApp = this; sApp = this;
gApp = this; gApp = this;
mMainThread = Thread.CurrentThread; mMainThread = Thread.CurrentThread;
IDEHelper_ProgramStart();
#if !CLI #if !CLI
mDebugger = new DebugManager(); mDebugger = new DebugManager();
mVerb = .OpenOrNew; mVerb = .OpenOrNew;

View file

@ -52,7 +52,7 @@ namespace A0
{ {
static ~this() static ~this()
{ {
IDE.Debugger.DebugManager.ProgramDone(); IDE.IDEApp.[Friend]IDEHelper_ProgramDone();
#if BF_PLATFORM_WINDOWS #if BF_PLATFORM_WINDOWS
if (IDE.IDEApp.sExitTest) if (IDE.IDEApp.sExitTest)

View file

@ -1364,11 +1364,9 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
numGenericParams = (int)typeDeclaration->mGenericParams->mGenericParams.size(); numGenericParams = (int)typeDeclaration->mGenericParams->mGenericParams.size();
if (outerTypeDef != NULL) if (outerTypeDef != NULL)
numGenericParams += (int)outerTypeDef->mGenericParamDefs.size(); numGenericParams += (int)outerTypeDef->mGenericParamDefs.size();
BfLogSys(mCurSource->mSystem, "DefBuilder %p Hash:%d isAutoComplete:%d\n", mCurTypeDef, mSystem->mTypeDefs.GetHash(mCurTypeDef), isAutoCompleteTempType);
if (!isAutoCompleteTempType) if (!isAutoCompleteTempType)
{ {
BfTypeDef* prevDef = NULL; BfTypeDef* prevDef = NULL;
// auto checkTypeDef = mSystem->mTypeDefs.Find(fullName); // auto checkTypeDef = mSystem->mTypeDefs.Find(fullName);
@ -1466,7 +1464,8 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
outerTypeDef->mNestedTypes.push_back(mCurActualTypeDef); outerTypeDef->mNestedTypes.push_back(mCurActualTypeDef);
} }
BfLogSysM("Creating TypeDef %p from TypeDecl: %p Source: %p ResolvePass: %d\n", mCurTypeDef, typeDeclaration, typeDeclaration->GetSourceData(), mResolvePassData != NULL); BfLogSysM("Creating TypeDef %p Hash:%d from TypeDecl: %p Source: %p ResolvePass: %d AutoComplete:%d\n", mCurTypeDef, mSystem->mTypeDefs.GetHash(mCurTypeDef), typeDeclaration,
typeDeclaration->GetSourceData(), mResolvePassData != NULL, isAutoCompleteTempType);
mCurTypeDef->mSource = mCurSource; mCurTypeDef->mSource = mCurSource;
mCurTypeDef->mSource->mRefCount++; mCurTypeDef->mSource->mRefCount++;

View file

@ -3813,4 +3813,3 @@ BF_EXPORT void BF_CALLTYPE BfSystem_FixTypes(BfSystem* bfSystem)
fixTypesHelper.mBfSystem = bfSystem; fixTypesHelper.mBfSystem = bfSystem;
fixTypesHelper.Fix(); fixTypesHelper.Fix();
} }

View file

@ -629,9 +629,7 @@ BF_EXPORT void BF_CALLTYPE Debugger_Create()
//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_EVERY_16_DF); //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_EVERY_16_DF);
//TODO: _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_EVERY_16_DF*/); //TODO: _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_EVERY_16_DF*/);
//_CrtSetAllocHook(BfAllocHook); //_CrtSetAllocHook(BfAllocHook);
BfIRCodeGen::StaticInit();
#ifdef BF_PLATFORM_WINDOWS #ifdef BF_PLATFORM_WINDOWS
_CrtMemCheckpoint(&gStartMemCheckpoint); _CrtMemCheckpoint(&gStartMemCheckpoint);
#endif #endif
@ -683,7 +681,12 @@ BF_EXPORT void BF_CALLTYPE Debugger_Delete()
#endif #endif
} }
BF_EXPORT void BF_CALLTYPE Debugger_ProgramDone() BF_EXPORT void BF_CALLTYPE IDEHelper_ProgramStart()
{
BfIRCodeGen::StaticInit();
}
BF_EXPORT void BF_CALLTYPE IDEHelper_ProgramDone()
{ {
//TODO: //TODO:
//::MessageBoxA(NULL, "Done", "Done", MB_OK); //::MessageBoxA(NULL, "Done", "Done", MB_OK);