mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Minor optimizations
This commit is contained in:
parent
0c955e5c66
commit
3736281ff7
4 changed files with 25 additions and 13 deletions
|
@ -1886,7 +1886,7 @@ String BeModule::ToString(BeFunction* wantFunc)
|
||||||
{
|
{
|
||||||
Dictionary<int, BeDbgLoc*> dbgLocs;
|
Dictionary<int, BeDbgLoc*> dbgLocs;
|
||||||
|
|
||||||
String str;
|
StringT<128*1024> str;
|
||||||
|
|
||||||
SetAndRestoreValue<BeFunction*> prevActiveFunc(mActiveFunction, NULL);
|
SetAndRestoreValue<BeFunction*> prevActiveFunc(mActiveFunction, NULL);
|
||||||
|
|
||||||
|
@ -1943,12 +1943,12 @@ String BeModule::ToString(BeFunction* wantFunc)
|
||||||
if (gv->mInitializer != NULL)
|
if (gv->mInitializer != NULL)
|
||||||
{
|
{
|
||||||
str += " ";
|
str += " ";
|
||||||
str += dc.ToString(gv->mInitializer);
|
dc.ToString(str, gv->mInitializer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str += " ";
|
str += " ";
|
||||||
str += dc.ToString(gv->mType);
|
dc.ToString(str, gv->mType);
|
||||||
}
|
}
|
||||||
if (gv->mAlign != -1)
|
if (gv->mAlign != -1)
|
||||||
{
|
{
|
||||||
|
@ -2005,8 +2005,10 @@ String BeModule::ToString(BeFunction* wantFunc)
|
||||||
str += " = {";
|
str += " = {";
|
||||||
if (dbgStructType->mSize != -1)
|
if (dbgStructType->mSize != -1)
|
||||||
{
|
{
|
||||||
str += StrFormat("\n Size: %d", dbgStructType->mSize);
|
str += "\n Size: ";
|
||||||
str += StrFormat("\n Align: %d", dbgStructType->mAlign);
|
str += StrFormat("%d", dbgStructType->mSize);
|
||||||
|
str += "\n Align : ";
|
||||||
|
str += StrFormat("%d", dbgStructType->mAlign);
|
||||||
}
|
}
|
||||||
if (dbgStructType->mDerivedFrom != NULL)
|
if (dbgStructType->mDerivedFrom != NULL)
|
||||||
{
|
{
|
||||||
|
@ -2045,12 +2047,15 @@ String BeModule::ToString(BeFunction* wantFunc)
|
||||||
str += " = enum {";
|
str += " = enum {";
|
||||||
if (dbgEnumType->mSize != -1)
|
if (dbgEnumType->mSize != -1)
|
||||||
{
|
{
|
||||||
str += StrFormat("\n Size: %d", dbgEnumType->mSize);
|
str += "\n Size: ";
|
||||||
str += StrFormat("\n Align: %d", dbgEnumType->mAlign);
|
str += StrFormat("%d", dbgEnumType->mSize);
|
||||||
|
str += "\n Align : ";
|
||||||
|
str += StrFormat("%d", dbgEnumType->mAlign);
|
||||||
}
|
}
|
||||||
if (dbgEnumType->mElementType != NULL)
|
if (dbgEnumType->mElementType != NULL)
|
||||||
{
|
{
|
||||||
str += "\n Underlying: "; str += dc.ToString(dbgEnumType->mElementType);
|
str += "\n Underlying: ";
|
||||||
|
dc.ToString(str, dbgEnumType->mElementType);
|
||||||
}
|
}
|
||||||
if (!dbgEnumType->mMembers.IsEmpty())
|
if (!dbgEnumType->mMembers.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,7 @@ void BfCodeGenDirectoryData::Write()
|
||||||
if (!DirectoryExists(directory))
|
if (!DirectoryExists(directory))
|
||||||
{
|
{
|
||||||
// Someone else (or the user) cleared this directory
|
// Someone else (or the user) cleared this directory
|
||||||
DoBfLog(2, "BfCodeGen cleared cache because '%s' was removed\n", directory.c_str());
|
BfLogX(2, "BfCodeGen cleared cache because '%s' was removed\n", directory.c_str());
|
||||||
mFileMap.Clear();
|
mFileMap.Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ void BfCodeGenThread::RunLoop()
|
||||||
Val128 hash;
|
Val128 hash;
|
||||||
Val128 orderedHash;
|
Val128 orderedHash;
|
||||||
|
|
||||||
DoBfLog(2, "BfCodeGen handle %s\n", request->mOutFileName.c_str());
|
BfLogX(2, "BfCodeGen handle %s\n", request->mOutFileName.c_str());
|
||||||
|
|
||||||
bool isLibWrite = (request->mOptions.mOptLevel == BfOptLevel_OgPlus) && (request->mOptions.mWriteToLib) && (!request->mOptions.mIsHotCompile);
|
bool isLibWrite = (request->mOptions.mOptLevel == BfOptLevel_OgPlus) && (request->mOptions.mWriteToLib) && (!request->mOptions.mIsHotCompile);
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ void BfCodeGenThread::RunLoop()
|
||||||
hashCtx.Mixin(request->mOptions.mHash);
|
hashCtx.Mixin(request->mOptions.mHash);
|
||||||
beIRCodeGen->Hash(hashCtx);
|
beIRCodeGen->Hash(hashCtx);
|
||||||
auto newOrderedHash = hashCtx.Finish128();
|
auto newOrderedHash = hashCtx.Finish128();
|
||||||
DoBfLog(2, "Ordered hash for %s New:%s Old:%s\n", cacheFileName.c_str(), newOrderedHash.ToString().c_str(), orderedHash.ToString().c_str());
|
BfLogX(2, "Ordered hash for %s New:%s Old:%s\n", cacheFileName.c_str(), newOrderedHash.ToString().c_str(), orderedHash.ToString().c_str());
|
||||||
hasCacheMatch = newOrderedHash == orderedHash;
|
hasCacheMatch = newOrderedHash == orderedHash;
|
||||||
|
|
||||||
errorMsg = beIRCodeGen->mErrorMsg;
|
errorMsg = beIRCodeGen->mErrorMsg;
|
||||||
|
@ -442,7 +442,7 @@ void BfCodeGenThread::RunLoop()
|
||||||
beIRCodeGen->Process();
|
beIRCodeGen->Process();
|
||||||
errorMsg = beIRCodeGen->mErrorMsg;
|
errorMsg = beIRCodeGen->mErrorMsg;
|
||||||
|
|
||||||
DoBfLog(2, "Generating obj %s\n", request->mOutFileName.c_str());
|
BfLogX(2, "Generating obj %s\n", request->mOutFileName.c_str());
|
||||||
|
|
||||||
BeCOFFObject coffObject;
|
BeCOFFObject coffObject;
|
||||||
coffObject.mWriteToLib = request->mOptions.mWriteToLib;
|
coffObject.mWriteToLib = request->mOptions.mWriteToLib;
|
||||||
|
|
|
@ -1861,6 +1861,13 @@ public:
|
||||||
#define BfLog(fmt, ...) {} // Nothing
|
#define BfLog(fmt, ...) {} // Nothing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BF_WANTS_LOG
|
||||||
|
#define BfLogX(logIdx, fmt, ...) DoBfLog(logIdx, fmt, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define BfLogX(logIdx, fmt, ...) {} // Nothing
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef BF_WANTS_LOG_SYS
|
#ifdef BF_WANTS_LOG_SYS
|
||||||
#define BfLogSys(sys, fmt, ...) DoBfLog((sys)->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
|
#define BfLogSys(sys, fmt, ...) DoBfLog((sys)->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
|
||||||
#define BfLogSysM(fmt, ...) DoBfLog(mSystem->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
|
#define BfLogSysM(fmt, ...) DoBfLog(mSystem->mIsResolveOnly ? 1 : 2, fmt, ##__VA_ARGS__)
|
||||||
|
|
|
@ -9574,7 +9574,7 @@ CeContext* CeMachine::AllocContext()
|
||||||
mCurEmitContext = NULL;
|
mCurEmitContext = NULL;
|
||||||
mExecuteId++;
|
mExecuteId++;
|
||||||
ceContext->mStackSize = BF_CE_DEFAULT_STACK_SIZE;
|
ceContext->mStackSize = BF_CE_DEFAULT_STACK_SIZE;
|
||||||
ceContext->mMemory.Resize(ceContext->mStackSize);
|
ceContext->mMemory.ResizeRaw(ceContext->mStackSize);
|
||||||
ceContext->mExecuteId = mExecuteId;
|
ceContext->mExecuteId = mExecuteId;
|
||||||
ceContext->mCurHandleId = 0;
|
ceContext->mCurHandleId = 0;
|
||||||
return ceContext;
|
return ceContext;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue