| 587 | ////////////////////////////////////////////////////////////////////////// |
| 588 | |
| 589 | BfCodeGen::BfCodeGen() |
| 590 | { |
| 591 | mAttemptedReleaseThunkLoad = false; |
| 592 | mIsUsingReleaseThunk = false; |
| 593 | mReleaseModule = NULL; |
| 594 | mClearCacheFunc = NULL; |
| 595 | mGetVersionFunc = NULL; |
| 596 | mKillFunc = NULL; |
| 597 | mCancelFunc = NULL; |
| 598 | mFinishFunc = NULL; |
| 599 | mGenerateObjFunc = NULL; |
| 600 | |
| 601 | mRequestIdx = 0; |
| 602 | #ifdef MAX_THREADS |
| 603 | mMaxThreadCount = MAX_THREADS; |
| 604 | #else |
| 605 | mMaxThreadCount = 6; |
| 606 | #endif |
| 607 | mQueuedCount = 0; |
| 608 | mCompletionCount = 0; |
| 609 | mDisableCacheReads = false; |
| 610 | |
| 611 | HashContext hashCtx; |
| 612 | hashCtx.Mixin(BF_CODEGEN_VERSION); |
| 613 | |
| 614 | #ifdef BF_PLATFORM_WINDOWS |
| 615 | char path[MAX_PATH]; |
| 616 | ::GetModuleFileNameA(NULL, path, MAX_PATH); |
| 617 | |
| 618 | if (_strnicmp(path + 2, "\\Beef\\", 6) == 0) |
| 619 | { |
| 620 | path[8] = 0; |
| 621 | |
| 622 | char* checkFileNames[] = |
| 623 | { |
| 624 | "IDEHelper/Backend/BeCOFFObject.cpp", |
| 625 | "IDEHelper/Backend/BeCOFFObject.h", |
| 626 | "IDEHelper/Backend/BeContext.cpp", |
| 627 | "IDEHelper/Backend/BeContext.h", |
| 628 | "IDEHelper/Backend/BeDbgModule.h", |
| 629 | "IDEHelper/Backend/BeIRCodeGen.cpp", |
| 630 | "IDEHelper/Backend/BeIRCodeGen.h", |
| 631 | "IDEHelper/Backend/BeLibManager.cpp", |
| 632 | "IDEHelper/Backend/BeLibManager.h", |
| 633 | "IDEHelper/Backend/BeMCContext.cpp", |
| 634 | "IDEHelper/Backend/BeMCContext.h", |
| 635 | "IDEHelper/Backend/BeModule.cpp", |
| 636 | "IDEHelper/Backend/BeModule.h", |
| 637 | "IDEHelper/Compiler/BfCodeGen.cpp", |
| 638 | "IDEHelper/Compiler/BfCodeGen.h", |
| 639 | "IDEHelper/Compiler/BfIRBuilder.cpp", |
| 640 | "IDEHelper/Compiler/BfIRBuilder.h", |
| 641 | "IDEHelper/Compiler/BfIRCodeGen.cpp", |
| 642 | "IDEHelper/Compiler/BfIRCodeGen.h", |
| 643 | }; |
| 644 | |
| 645 | for (int i = 0; i < BF_ARRAY_COUNT(checkFileNames); i++) |
| 646 | { |