Prechádzať zdrojové kódy

Large allocation fixes

Brian Fiete 5 rokov pred
rodič
commit
601b08fb2d

+ 3 - 3
IDEHelper/Compiler/BfStmtEvaluator.cpp

@@ -4833,9 +4833,9 @@ void BfModule::Visit(BfBreakStatement* breakStmt)
 			if (checkScope == breakData->mScope)
 				break;
 			if (checkScope->mIsDeferredBlock)
-			{
-				Fail("The break target crosses a deferred block boundary", breakStmt);
-				return;
+			{				
+ 				Fail("The break target crosses a deferred block boundary", breakStmt);
+ 				return;
 			}
 			checkScope = checkScope->mPrevScope;
 		}

+ 1 - 1
IDEHelper/DbgExprEvaluator.cpp

@@ -7318,7 +7318,7 @@ DbgTypedValue DbgExprEvaluator::MatchMethod(BfAstNode* targetSrc, DbgTypedValue
 		if (argValues.size() >= 2)
 		{			
 			if ((argValues[1].mType != NULL) && (argValues[1].mType->IsInteger()))
-				mCountResultOverride = (int)argValues[1].GetInt64();
+				mCountResultOverride = (intptr)argValues[1].GetInt64();
 			return argValues[0];
 		}
 	}

+ 1 - 1
IDEHelper/DbgExprEvaluator.h

@@ -265,7 +265,7 @@ public:
 	DbgSubprogram* mCurMethod;
 	DbgTypedValue mResult;
 	DbgTypedValue* mReceivingValue;
-	int mCountResultOverride;
+	intptr mCountResultOverride;
 	DbgTypedValue mExplicitThis;	
 	BfExpression* mExplicitThisExpr;
 	Array<DbgCallResult>* mCallResults;	

+ 10 - 10
IDEHelper/DbgModule.cpp

@@ -1710,13 +1710,13 @@ String DbgType::ToString(DbgLanguage language, bool allowDirectBfObject)
 			auto checkType = this;
 			while (checkType->mTypeCode == DbgType_SizedArray)			
 			{
-				int innerSize = checkType->mTypeParam->GetStride();
-				int arrSize = 0;
+				intptr innerSize = checkType->mTypeParam->GetStride();
+				intptr arrSize = 0;
 				if (innerSize > 0)
 				{
 					arrSize = checkType->GetStride() / innerSize;
 				}
-				name += StrFormat("[%d]", arrSize);
+				name += StrFormat("[%lld]", arrSize);
 				checkType = checkType->mTypeParam;
 			}			 
 			name = checkType->ToString(language) + name;
@@ -1775,7 +1775,7 @@ String DbgType::ToString(DbgLanguage language, bool allowDirectBfObject)
 	return "???";
 }
 
-int DbgType::GetByteCount()
+intptr DbgType::GetByteCount()
 {	
 	if (!mSizeCalculated)
 	{
@@ -1820,7 +1820,7 @@ int DbgType::GetByteCount()
 				}
 				else
 				{
-					int elemCount = BF_ALIGN(mSize, primaryType->mAlign) / primaryType->GetStride();
+					intptr elemCount = BF_ALIGN(mSize, primaryType->mAlign) / primaryType->GetStride();
 					if (elemCount > 0)
 					{
 						mSize = ((elemCount - 1) * primaryType->GetStride()) + primaryType->GetByteCount();
@@ -1836,7 +1836,7 @@ int DbgType::GetByteCount()
 	return mSize;
 }
 
-int DbgType::GetStride()
+intptr DbgType::GetStride()
 {
 	return BF_ALIGN(GetByteCount(), GetAlign());
 }
@@ -6086,7 +6086,7 @@ bool DbgModule::ReadCOFF(DataStream* stream, DbgModuleKind moduleKind)
 												{
 													auto staticVar = itr->second;
 													mainModule->mTLSExtraAddr = extraSym->mValue->mAddress;
-													mainModule->mTLSExtraSize = staticVar->mType->GetByteCount();
+													mainModule->mTLSExtraSize = (int)staticVar->mType->GetByteCount();
 												}
 											}
 										}
@@ -6780,8 +6780,8 @@ void DbgModule::ProcessHotSwapVariables()
 						continue;
 					
 					uint8* newData = GetHotTargetData(newAddress);
-					int newArraySize = staticVariable->mType->GetByteCount();
-					int oldArraySize = oldVariable->mType->GetByteCount();
+					int newArraySize = (int)staticVariable->mType->GetByteCount();
+					int oldArraySize = (int)oldVariable->mType->GetByteCount();
 
 					int copySize = std::min(newArraySize, oldArraySize);
 
@@ -6863,7 +6863,7 @@ void DbgModule::ProcessHotSwapVariables()
 				{
 					if ((strncmp(oldVariable->mName, "?sBfTypeData@", 13) == 0) || (strncmp(oldVariable->mName, "sBfTypeData.", 12) == 0))
 					{
-						int size = staticVariable->mType->GetByteCount();												
+						int size = (int)staticVariable->mType->GetByteCount();
 						addr_target oldAddress = mDebugTarget->GetStaticAddress(oldVariable);
 						addr_target newAddress = _GetNewAddress();
 						if (newAddress == 0)

+ 4 - 4
IDEHelper/DbgModule.h

@@ -557,8 +557,8 @@ public:
 		
 	const char* mName;
 	const char* mTypeName;
-	int mTemplateNameIdx;
-	int mSize; // In bytes
+	intptr mSize; // In bytes
+	int mTemplateNameIdx;	
 	int mAlign;
 	int mDeclFileIdx;
 	int mDeclLine;	
@@ -637,8 +637,8 @@ public:
 	DbgType* RemoveModifiers(bool* hadRef = NULL);	
 	String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown);
 	String ToString(DbgLanguage language = DbgLanguage_Unknown, bool allowDirectBfObject = false);
-	int GetByteCount();
-	int GetStride();
+	intptr GetByteCount();
+	intptr GetStride();
 	int GetAlign();	
 	void EnsureMethodsMapped();
 };

+ 13 - 13
IDEHelper/WinDebugger.cpp

@@ -5366,7 +5366,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
 				DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
 				DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
 				if ((countValue) && (countValue.mType->IsInteger()))
-					formatInfo->mOverrideCount = (int)countValue.GetInt64();
+					formatInfo->mOverrideCount = (intptr)countValue.GetInt64();
 				if (dbgEvaluationContext.HadError())
 				{					
 					if (errorString != NULL)
@@ -5386,7 +5386,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
 				DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
 				DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
 				if ((countValue) && (countValue.mType->IsInteger()))
-					formatInfo->mOverrideCount = (int)countValue.GetInt64();
+					formatInfo->mOverrideCount = (intptr)countValue.GetInt64();
 				if (dbgEvaluationContext.HadError())
 				{
 					if (errorString != NULL)
@@ -5406,7 +5406,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
 				DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
 				DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
 				if ((countValue) && (countValue.mType->IsInteger()))
-					formatInfo->mArrayLength = (int)countValue.GetInt64();
+					formatInfo->mArrayLength = (intptr)countValue.GetInt64();
 				if (dbgEvaluationContext.HadError())
 				{
 					if (errorString != NULL)
@@ -5529,7 +5529,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
 				DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
 				DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
 				if ((countValue) && (countValue.mType->IsInteger()))
-					formatInfo->mArrayLength = (int)countValue.GetInt64();
+					formatInfo->mArrayLength = (intptr)countValue.GetInt64();
 				if (dbgEvaluationContext.HadError())
 				{
 					if (errorString != NULL)
@@ -6143,7 +6143,7 @@ DebugVisualizerEntry* WinDebugger::FindVisualizerForType(DbgType* dbgType, Array
 
 #define GET_FROM(ptr, T) *((T*)(ptr += sizeof(T)) - 1)
 
-String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, int maxLength, DwFormatInfo& formatInfo)
+String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo)
 {	
 	int origMaxLength = maxLength;
 	if (addr == 0)
@@ -6154,7 +6154,7 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
 	String retVal = "\"";
 	bool wasTerminated = false;
 	String valString;	
-	int maxShowSize = 255;
+	intptr maxShowSize = 255;
 
 	if (maxLength == -1)
 		maxLength = formatInfo.mOverrideCount;
@@ -6457,7 +6457,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 			return "";
 	}
 	
-	auto _ShowArraySummary = [&](String& retVal, addr_target ptrVal, int arraySize, DbgType* innerType)
+	auto _ShowArraySummary = [&](String& retVal, addr_target ptrVal, int64 arraySize, DbgType* innerType)
 	{
 		String displayString;
 		displayString += "{";
@@ -6480,7 +6480,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 
 			// Why did we have this "na" on here? It made "void*[3]" type things show up as "{,,}"
 			//String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%d], na", idx);
-			String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%d]", idx);
+			String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%lld]", idx);
 			DbgTypedValue evalResult = EvaluateInContext(dbgCompileUnit, typedValue, evalStr, &displayStrFormatInfo);
 			String result;
 			if (evalResult)
@@ -6512,7 +6512,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 			{
 				retVal = EncodeDataPtr(ptrVal, true) + " ";
 				retVal += dwValueType->mTypeParam->ToString(language);
-				retVal += StrFormat("[%d] ", formatInfo.mArrayLength);				
+				retVal += StrFormat("[%lld] ", (int64)formatInfo.mArrayLength);				
 			}
 
 			_ShowArraySummary(retVal, ptrVal, formatInfo.mArrayLength, dwValueType->mTypeParam);
@@ -6525,7 +6525,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 
 			String evalStr = "*((" + typedValue.mType->ToStringRaw(language) + ")" + EncodeDataPtr(ptrVal, true) + " + {0})";
 
-			retVal += "\n:repeat" + StrFormat("\t%d\t%d\t%d", 0, (int)BF_MAX(formatInfo.mArrayLength, 0), 10000) +
+			retVal += "\n:repeat" + StrFormat("\t%d\t%lld\t%d", 0, (int)BF_MAX(formatInfo.mArrayLength, 0), 10000) +
 				"\t" + idxStr + "\t" + evalStr;
 			return retVal;
 		}
@@ -7125,8 +7125,8 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 		if (ptrVal == 0)
 			ptrVal = typedValue.mPtr;		
 
-		int arraySize = 0;
-		int innerSize = innerType->GetStride();
+		intptr arraySize = 0;
+		intptr innerSize = innerType->GetStride();
 		if (innerSize > 0)
 			arraySize = arrayType->GetStride() / innerSize;
 		else
@@ -7160,7 +7160,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 		evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + ")[{0}], refid=" + MaybeQuoteFormatInfoParam(referenceId + ".[]");
 		if (typedValue.mIsReadOnly)
 			evalStr += ", ne";
-		retVal += "\n:repeat" + StrFormat("\t%d\t%d\t%d", 0, (int)BF_MAX(arraySize, 0), 10000) +
+		retVal += "\n:repeat" + StrFormat("\t%d\t%lld\t%d", 0, (int)BF_MAX(arraySize, 0), 10000) +
 			"\t" + idxStr + "\t" + evalStr;
 		return retVal;
 	}

+ 4 - 4
IDEHelper/WinDebugger.h

@@ -278,9 +278,9 @@ struct DwFormatInfo
 	bool mNoMembers;
 	bool mRawString;	
 	bool mNoEdit;
-	int mArrayLength;
-	int mOverrideCount;
-	int mMaxCount;
+	intptr mArrayLength;
+	intptr mOverrideCount;
+	intptr mMaxCount;
 	DwDisplayType mDisplayType;
 	DbgTypedValue mExplicitThis;
 	int mTotalSummaryLength;	
@@ -501,7 +501,7 @@ public:
 	bool EvalCondition(DebugVisualizerEntry* debugVis, DbgCompileUnit* dbgCompileUnit, DbgTypedValue typedVal, DwFormatInfo& formatInfo, const StringImpl& condition, const Array<String>& dbgVisWildcardCaptures, String& errorStr);
 	DwDisplayInfo* GetDisplayInfo(const StringImpl& referenceId);
 	void ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength);
-	String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, int maxLength, DwFormatInfo& formatInfo);
+	String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo);
 	String DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false);
 	bool ShouldShowStaticMember(DbgType* dbgType, DbgVariable* member);
 	String GetMemberList(DbgType* dbgType, const StringImpl& expr, bool isPtr, bool isStatic, bool forceCast = false, bool isSplat = false, bool isReadOnly = false);