mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-19 18:56:33 +01:00
rtl/morphos: add optional support for the OSHeap allocator
This commit is contained in:
parent
4f9242758f
commit
53eeb1cf0f
@ -24,6 +24,11 @@ unit System;
|
||||
interface
|
||||
|
||||
{$define FPC_IS_SYSTEM}
|
||||
{.$define FPC_MORPHOS_USE_OSHEAP}
|
||||
|
||||
{$ifdef FPC_MORPHOS_USE_OSHEAP}
|
||||
{$define HAS_MEMORYMANAGER}
|
||||
{$endif FPC_MORPHOS_USE_OSHEAP}
|
||||
|
||||
{$I systemh.inc}
|
||||
{$I osdebugh.inc}
|
||||
@ -81,6 +86,9 @@ implementation
|
||||
{$define FPC_SYSTEM_HAS_STACKTOP}
|
||||
|
||||
{$I system.inc}
|
||||
{$ifdef FPC_MORPHOS_USE_OSHEAP}
|
||||
{$i osheap.inc}
|
||||
{$endif FPC_MORPHOS_USE_OSHEAP}
|
||||
{$I osdebug.inc}
|
||||
|
||||
function StackTop: pointer;
|
||||
@ -186,6 +194,11 @@ begin
|
||||
randseed:=tmpTime.ds_tick;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC_MORPHOS_USE_OSHEAP}
|
||||
var
|
||||
{ generated by the compiler based on the $MEMORY directive }
|
||||
heapsize : PtrInt; external name '__heapsize';
|
||||
{$ENDIF FPC_MORPHOS_USE_OSHEAP}
|
||||
|
||||
{ MorphOS specific startup }
|
||||
procedure SysInitMorphOS;
|
||||
@ -204,7 +217,11 @@ begin
|
||||
if MOS_UtilityBase=nil then Halt(1);
|
||||
|
||||
{ Creating the memory pool for growing heap }
|
||||
{$IFNDEF FPC_MORPHOS_USE_OSHEAP}
|
||||
ASYS_heapPool:=CreatePool(MEMF_FAST or MEMF_SEM_PROTECTED,growheapsize2,growheapsize2 div 4);
|
||||
{$ELSE FPC_MORPHOS_USE_OSHEAP}
|
||||
ASYS_heapPool:=CreatePool(MEMF_FAST or MEMF_SEM_PROTECTED,min(heapsize,1024),min(heapsize div 2,1024));
|
||||
{$ENDIF FPC_MORPHOS_USE_OSHEAP}
|
||||
if ASYS_heapPool=nil then Halt(1);
|
||||
|
||||
{ Initialize semaphore for filelist access arbitration }
|
||||
@ -262,8 +279,11 @@ begin
|
||||
SysInitMorphOS;
|
||||
{ Set up signals handlers }
|
||||
// InstallSignals;
|
||||
{ Setup heap }
|
||||
{$ifndef FPC_MORPHOS_USE_OSHEAP}
|
||||
{ Setup heap }
|
||||
InitHeap;
|
||||
{$endif FPC_MORPHOS_USE_OSHEAP}
|
||||
SysInitExceptions;
|
||||
initunicodestringmanager;
|
||||
{ Setup stdin, stdout and stderr }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user