+ switch to using huge pointers in the tiny heap in the i8086 far data memory

models

git-svn-id: trunk@28333 -
This commit is contained in:
nickysn 2014-08-07 21:15:56 +00:00
parent 94bcb9878a
commit 6720f84d24

View File

@ -13,18 +13,29 @@
**********************************************************************}
{$ifdef cpui8086}
{$if defined(FPC_X86_DATA_FAR) or defined(FPC_X86_DATA_HUGE)}
{$define FPC_HEAP_HUGE}
{$endif}
{$endif cpui8086}
{$ifdef FPC_HEAP_HUGE}
{$HugePointerArithmeticNormalization On}
{$HugePointerComparisonNormalization On}
{$endif FPC_HEAP_HUGE}
type
{ TTinyHeapMemBlockSize holds the size of an *allocated* memory block,
and is written at position:
memblockstart-sizeof(TTinyHeapMemBlockSize) }
PTinyHeapMemBlockSize = ^TTinyHeapMemBlockSize;
PTinyHeapMemBlockSize = ^TTinyHeapMemBlockSize; {$ifdef FPC_HEAP_HUGE}huge;{$endif}
TTinyHeapMemBlockSize = PtrUInt;
{ TTinyHeapFreeBlockSize holds the size of a *free* memory block, as a
part of the TTinyHeapBlock structure }
TTinyHeapFreeBlockSize = PtrUInt;
TTinyHeapPointerArithmeticType = ^Byte;
TTinyHeapPointerArithmeticType = ^Byte; {$ifdef FPC_HEAP_HUGE}huge;{$endif}
const
TinyHeapMinBlock = 4*sizeof(pointer);
@ -261,7 +272,7 @@
if (ASize and 1) <> 0 then
Dec(ASize);
PTinyHeapMemBlockSize(AAddress)^ := ASize - SizeOf(TTinyHeapMemBlockSize);
FreeMem(PTinyHeapMemBlockSize(AAddress) + 1, ASize - SizeOf(TTinyHeapMemBlockSize));
FreeMem(Pointer(PTinyHeapMemBlockSize(AAddress) + 1), ASize - SizeOf(TTinyHeapMemBlockSize));
end;
const