mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 22:40:30 +02:00
rtl/amiga: add support for OSHeap, now default in legacy mode, optional define otherwise
This commit is contained in:
parent
273a598be8
commit
53a67b34b5
@ -27,18 +27,15 @@ interface
|
|||||||
{$define AMIGA_LEGACY}
|
{$define AMIGA_LEGACY}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef AMIGA_LEGACY}
|
{$if defined(AMIGA_LEGACY) or defined(AMIGA_USE_OSHEAP)}
|
||||||
{$.define FPC_AMIGA_USE_TINYHEAP}
|
{$define FPC_AMIGA_USE_OSHEAP}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
{$ifdef FPC_AMIGA_USE_OSHEAP}
|
||||||
{$define HAS_MEMORYMANAGER}
|
{$define HAS_MEMORYMANAGER}
|
||||||
{$endif FPC_AMIGA_USE_TINYHEAP}
|
{$endif FPC_AMIGA_USE_OSHEAP}
|
||||||
|
|
||||||
{$I systemh.inc}
|
{$I systemh.inc}
|
||||||
{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
|
||||||
{$i tnyheaph.inc}
|
|
||||||
{$endif FPC_AMIGA_USE_TINYHEAP}
|
|
||||||
{$I osdebugh.inc}
|
{$I osdebugh.inc}
|
||||||
|
|
||||||
{$if defined(cpum68k) and defined(fpusoft)}
|
{$if defined(cpum68k) and defined(fpusoft)}
|
||||||
@ -151,9 +148,9 @@ implementation
|
|||||||
{$endif defined(cpum68k) and defined(fpusoft)}
|
{$endif defined(cpum68k) and defined(fpusoft)}
|
||||||
|
|
||||||
{$I system.inc}
|
{$I system.inc}
|
||||||
{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
{$ifdef FPC_AMIGA_USE_OSHEAP}
|
||||||
{$i tinyheap.inc}
|
{$i osheap.inc}
|
||||||
{$endif FPC_AMIGA_USE_TINYHEAP}
|
{$endif FPC_AMIGA_USE_OSHEAP}
|
||||||
{$I osdebug.inc}
|
{$I osdebug.inc}
|
||||||
|
|
||||||
{$IFDEF AMIGAOS4}
|
{$IFDEF AMIGAOS4}
|
||||||
@ -263,6 +260,12 @@ begin
|
|||||||
randseed:=tmpTime.ds_tick;
|
randseed:=tmpTime.ds_tick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF FPC_AMIGA_USE_OSHEAP}
|
||||||
|
var
|
||||||
|
{ generated by the compiler based on the $MEMORY directive }
|
||||||
|
heapsize : PtrInt; external name '__heapsize';
|
||||||
|
{$ENDIF FPC_AMIGA_USE_OSHEAP}
|
||||||
|
|
||||||
|
|
||||||
{ AmigaOS specific startup }
|
{ AmigaOS specific startup }
|
||||||
procedure SysInitAmigaOS;
|
procedure SysInitAmigaOS;
|
||||||
@ -291,7 +294,11 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{ Creating the memory pool for growing heap }
|
{ Creating the memory pool for growing heap }
|
||||||
|
{$IFNDEF FPC_AMIGA_USE_OSHEAP}
|
||||||
ASYS_heapPool:=CreatePool(MEMF_ANY,growheapsize2,growheapsize1);
|
ASYS_heapPool:=CreatePool(MEMF_ANY,growheapsize2,growheapsize1);
|
||||||
|
{$ELSE FPC_AMIGA_USE_OSHEAP}
|
||||||
|
ASYS_heapPool:=CreatePool(MEMF_ANY,min(heapsize,1024),min(heapsize div 2,1024));
|
||||||
|
{$ENDIF FPC_AMIGA_USE_OSHEAP}
|
||||||
if ASYS_heapPool=nil then Halt(1);
|
if ASYS_heapPool=nil then Halt(1);
|
||||||
ASYS_heapSemaphore:=AllocPooled(ASYS_heapPool,sizeof(TSignalSemaphore));
|
ASYS_heapSemaphore:=AllocPooled(ASYS_heapPool,sizeof(TSignalSemaphore));
|
||||||
if ASYS_heapSemaphore = nil then Halt(1);
|
if ASYS_heapSemaphore = nil then Halt(1);
|
||||||
@ -352,10 +359,10 @@ begin
|
|||||||
SysInitAmigaOS;
|
SysInitAmigaOS;
|
||||||
{ Set up signals handlers }
|
{ Set up signals handlers }
|
||||||
// InstallSignals;
|
// InstallSignals;
|
||||||
{$ifndef FPC_AMIGA_USE_TINYHEAP}
|
{$ifndef FPC_AMIGA_USE_OSHEAP}
|
||||||
{ Setup heap }
|
{ Setup heap }
|
||||||
InitHeap;
|
InitHeap;
|
||||||
{$endif FPC_AMIGA_USE_TINYHEAP}
|
{$endif FPC_AMIGA_USE_OSHEAP}
|
||||||
SysInitExceptions;
|
SysInitExceptions;
|
||||||
{$ifdef cpum68k}
|
{$ifdef cpum68k}
|
||||||
fpc_cpucodeinit;
|
fpc_cpucodeinit;
|
||||||
|
Loading…
Reference in New Issue
Block a user