FpDbg: less memory rpe-allocation in scope-list

git-svn-id: trunk@42878 -
This commit is contained in:
martin 2013-09-19 17:38:53 +00:00
parent fa3b7a0f0f
commit 0e9ae75b7a

View File

@ -474,6 +474,9 @@ implementation
var
FPDBG_DWARF_WARNINGS, FPDBG_DWARF_VERBOSE: PLazLoggerLogGroup;
const
SCOPE_ALLOC_BLOCK_SIZE = 4096; // Increase scopelist in steps of
function ULEB128toOrdinal(var p: PByte): QWord;
var
n: Byte;
@ -929,8 +932,9 @@ function TDwarfScopeInfo.CreateScopeForEntry(AEntry: Pointer; ALink: Integer): I
begin
inc(FScopeList^.HighestKnown);
Result := FScopeList^.HighestKnown;
if (Result >= Length(FScopeList^.List)) and (Length(FScopeList^.List) < SCOPE_ALLOC_BLOCK_SIZE) then DebugLn(['xxxxxxx ', Length(FScopeList^.List)]);
if Result >= Length(FScopeList^.List) then
SetLength(FScopeList^.List, Result + 4096);
SetLength(FScopeList^.List, Result + SCOPE_ALLOC_BLOCK_SIZE);
FScopeList^.List[Result].Entry := AEntry;
FScopeList^.List[Result].Link := ALink;
end;
@ -1711,9 +1715,9 @@ begin
FLineNumberMap := TStringList.Create;
FLineNumberMap.Sorted := True;
FLineNumberMap.Duplicates := dupError;
SetLength(FScopeList.List, 4096);
if FLength div 2 + 1 < SCOPE_ALLOC_BLOCK_SIZE then DebugLn(['+++++++', FLength]);
SetLength(FScopeList.List, Min(SCOPE_ALLOC_BLOCK_SIZE, FLength div 2 + 1));
FScopeList.List[0].Link := -1;
FScopeList.List[0].Entry := FInfoData;
FScopeList.HighestKnown := 0;