Explorar o código

+ added RegisterTinyHeapBlock_Simple_Prealigned procedure, which is the same as
RegisterTinyHeapBlock_Simple, but expects its address and size parameters to
be already aligned on a TinyHeapAllocGranularity boundary

git-svn-id: trunk@28651 -

nickysn %!s(int64=11) %!d(string=hai) anos
pai
achega
bb07318386
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      rtl/inc/tinyheap.inc

+ 14 - 0
rtl/inc/tinyheap.inc

@@ -316,6 +316,20 @@
         HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
         HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
       end;
       end;
 
 
+    { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
+      the heap is only a single contiguous memory block and the address and size
+      are already aligned on a TinyHeapAllocGranularity boundary. }
+    procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: PtrUInt);
+      begin
+{$ifdef DEBUG_TINY_HEAP}
+        Writeln('RegisterTinyHeapBlock_Simple_Prealigned(', HexStr(AAddress), ',', ASize, ')');
+{$endif DEBUG_TINY_HEAP}
+        HeapOrg:=AAddress;
+        HeapPtr:=AAddress;
+        FreeList:=AAddress;
+        HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
+      end;
+
     procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
     procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
       var
       var
         alignment_inc: smallint;
         alignment_inc: smallint;