Explorar o código

Change ASize type for RegisterTinyHeapBlockXXX functions

git-svn-id: trunk@36249 -
pierre %!s(int64=8) %!d(string=hai) anos
pai
achega
ade39069e5
Modificáronse 1 ficheiros con 7 adicións e 5 borrados
  1. 7 5
      rtl/inc/tinyheap.inc

+ 7 - 5
rtl/inc/tinyheap.inc

@@ -60,7 +60,7 @@
 
 
       TinyHeapAllocGranularity = sizeof(TTinyHeapBlock);
       TinyHeapAllocGranularity = sizeof(TTinyHeapBlock);
 
 
-    procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint); forward;
+    procedure RegisterTinyHeapBlock(AAddress: Pointer; ASize:{$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif}); forward;
 
 
     function EncodeTinyHeapFreeBlockSize(Size: PtrUInt): TTinyHeapFreeBlockSize; inline;
     function EncodeTinyHeapFreeBlockSize(Size: PtrUInt): TTinyHeapFreeBlockSize; inline;
       begin
       begin
@@ -148,12 +148,14 @@
                  p:=SysOSAlloc(AllocSize);
                  p:=SysOSAlloc(AllocSize);
                  if assigned(p) then
                  if assigned(p) then
                    begin
                    begin
+                     { This needs toi be fixed because
+                       HeapEnd and HeapSize are not updated correctly
                      if p > HeapPtr then
                      if p > HeapPtr then
                        begin
                        begin
                          prev:=HeapPtr;
                          prev:=HeapPtr;
                          HeapPtr:=p;
                          HeapPtr:=p;
                        end
                        end
-                     else
+                     else }
                        begin
                        begin
                          RegisterTinyHeapBlock(p,AllocSize);
                          RegisterTinyHeapBlock(p,AllocSize);
                          { Recursive call }
                          { Recursive call }
@@ -512,7 +514,7 @@
     { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
     { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
       the heap is only a single contiguous memory block. If you want to add
       the heap is only a single contiguous memory block. If you want to add
       multiple blocks to the heap, you should use RegisterTinyHeapBlock instead. }
       multiple blocks to the heap, you should use RegisterTinyHeapBlock instead. }
-    procedure RegisterTinyHeapBlock_Simple(AAddress: Pointer; ASize: PtrUInt);
+    procedure RegisterTinyHeapBlock_Simple(AAddress: Pointer; ASize:{$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
       begin
       begin
 {$ifdef DEBUG_TINY_HEAP}
 {$ifdef DEBUG_TINY_HEAP}
         Writeln('RegisterTinyHeapBlock_Simple(', HexStr(AAddress), ',', ASize, ')');
         Writeln('RegisterTinyHeapBlock_Simple(', HexStr(AAddress), ',', ASize, ')');
@@ -528,7 +530,7 @@
     { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
     { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
       the heap is only a single contiguous memory block and the address and size
       the heap is only a single contiguous memory block and the address and size
       are already aligned on a TinyHeapAllocGranularity boundary. }
       are already aligned on a TinyHeapAllocGranularity boundary. }
-    procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: PtrUInt);
+    procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: {$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
       begin
       begin
 {$ifdef DEBUG_TINY_HEAP}
 {$ifdef DEBUG_TINY_HEAP}
         Writeln('RegisterTinyHeapBlock_Simple_Prealigned(', HexStr(AAddress), ',', ASize, ')');
         Writeln('RegisterTinyHeapBlock_Simple_Prealigned(', HexStr(AAddress), ',', ASize, ')');
@@ -540,7 +542,7 @@
         HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
         HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
       end;
       end;
 
 
-    procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
+    procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: {$ifdef FPC_TINYHEAP_HUGE}LongInt{$else}PtrUInt{$endif});
       var
       var
         alignment_inc: smallint;
         alignment_inc: smallint;
         p: PTinyHeapBlock;
         p: PTinyHeapBlock;