|
@@ -27,18 +27,15 @@ interface
|
|
|
{$define AMIGA_LEGACY}
|
|
|
{$endif}
|
|
|
|
|
|
-{$ifdef AMIGA_LEGACY}
|
|
|
-{$.define FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$if defined(AMIGA_LEGACY) or defined(AMIGA_USE_OSHEAP)}
|
|
|
+{$define FPC_AMIGA_USE_OSHEAP}
|
|
|
{$endif}
|
|
|
|
|
|
-{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$ifdef FPC_AMIGA_USE_OSHEAP}
|
|
|
{$define HAS_MEMORYMANAGER}
|
|
|
-{$endif FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$endif FPC_AMIGA_USE_OSHEAP}
|
|
|
|
|
|
{$I systemh.inc}
|
|
|
-{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
|
|
-{$i tnyheaph.inc}
|
|
|
-{$endif FPC_AMIGA_USE_TINYHEAP}
|
|
|
{$I osdebugh.inc}
|
|
|
|
|
|
{$if defined(cpum68k) and defined(fpusoft)}
|
|
@@ -151,9 +148,9 @@ implementation
|
|
|
{$endif defined(cpum68k) and defined(fpusoft)}
|
|
|
|
|
|
{$I system.inc}
|
|
|
-{$ifdef FPC_AMIGA_USE_TINYHEAP}
|
|
|
-{$i tinyheap.inc}
|
|
|
-{$endif FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$ifdef FPC_AMIGA_USE_OSHEAP}
|
|
|
+{$i osheap.inc}
|
|
|
+{$endif FPC_AMIGA_USE_OSHEAP}
|
|
|
{$I osdebug.inc}
|
|
|
|
|
|
{$IFDEF AMIGAOS4}
|
|
@@ -263,6 +260,12 @@ begin
|
|
|
randseed:=tmpTime.ds_tick;
|
|
|
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 }
|
|
|
procedure SysInitAmigaOS;
|
|
@@ -291,7 +294,11 @@ begin
|
|
|
{$ENDIF}
|
|
|
|
|
|
{ Creating the memory pool for growing heap }
|
|
|
+{$IFNDEF FPC_AMIGA_USE_OSHEAP}
|
|
|
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);
|
|
|
ASYS_heapSemaphore:=AllocPooled(ASYS_heapPool,sizeof(TSignalSemaphore));
|
|
|
if ASYS_heapSemaphore = nil then Halt(1);
|
|
@@ -352,10 +359,10 @@ begin
|
|
|
SysInitAmigaOS;
|
|
|
{ Set up signals handlers }
|
|
|
// InstallSignals;
|
|
|
-{$ifndef FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$ifndef FPC_AMIGA_USE_OSHEAP}
|
|
|
{ Setup heap }
|
|
|
InitHeap;
|
|
|
-{$endif FPC_AMIGA_USE_TINYHEAP}
|
|
|
+{$endif FPC_AMIGA_USE_OSHEAP}
|
|
|
SysInitExceptions;
|
|
|
{$ifdef cpum68k}
|
|
|
fpc_cpucodeinit;
|