Kaynağa Gözat

Remove FPC_IN_HEAPMGR, FPC_NO_DEFAULT_MEMORYMANAGER, and unnecessary uses of FPC_NO_DEFAULT_HEAP.

Rika Ichinose 2 ay önce
ebeveyn
işleme
562048c965
6 değiştirilmiş dosya ile 17 ekleme ve 62 silme
  1. 7 31
      rtl/inc/heap.inc
  2. 2 10
      rtl/inc/heaph.inc
  3. 4 10
      rtl/inc/system.inc
  4. 2 4
      rtl/inc/thread.inc
  5. 2 6
      rtl/inc/threadvr.inc
  6. 0 1
      rtl/win16/system.pp

+ 7 - 31
rtl/inc/heap.inc

@@ -18,7 +18,6 @@
 { $define HAS_MEMORYMANAGER}
 
 { Memory manager }
-{$if not defined(FPC_NO_DEFAULT_MEMORYMANAGER)}
 const
   MemoryManager: TMemoryManager = (
     NeedLock: false;  // Obsolete
@@ -33,30 +32,12 @@ const
     RelocateHeap: nil;
     GetHeapStatus: {$ifndef FPC_NO_DEFAULT_HEAP}@SysGetHeapStatus{$else}nil{$endif};
     GetFPCHeapStatus: {$ifndef FPC_NO_DEFAULT_HEAP}@SysGetFPCHeapStatus{$else}nil{$endif};
-  );
-{$elseif not defined(FPC_IN_HEAPMGR)}
-const
-  MemoryManager: TMemoryManager = (
-    NeedLock: false;  // Obsolete
-    GetMem: nil;
-    FreeMem: nil;
-    FreeMemSize: nil;
-    AllocMem: nil;
-    ReAllocMem: nil;
-    MemSize: nil;
-    InitThread: nil;
-    DoneThread: nil;
-    RelocateHeap: nil;
-    GetHeapStatus: nil;
-    GetFPCHeapStatus: nil;
-  );public name 'FPC_SYSTEM_MEMORYMANAGER';
-{$endif FPC_IN_HEAPMGR}
+  ); {$ifdef FPC_NO_DEFAULT_HEAP} public name 'FPC_SYSTEM_MEMORYMANAGER'; {$endif}
 
 {*****************************************************************************
                              Memory Manager
 *****************************************************************************}
 
-{$ifndef FPC_IN_HEAPMGR}
 procedure GetMemoryManager(var MemMgr:TMemoryManager);
 begin
   MemMgr := MemoryManager;
@@ -70,12 +51,12 @@ end;
 
 function IsMemoryManagerSet:Boolean;
 begin
-{$if defined(HAS_MEMORYMANAGER) or defined(FPC_NO_DEFAULT_MEMORYMANAGER)}
+{$if defined(HAS_MEMORYMANAGER) or defined(FPC_NO_DEFAULT_HEAP)}
   Result:=false;
-{$else not FPC_NO_DEFAULT_MEMORYMANAGER}
+{$else not FPC_NO_DEFAULT_HEAP}
   IsMemoryManagerSet := (MemoryManager.GetMem<>@SysGetMem)
     or (MemoryManager.FreeMem<>@SysFreeMem);
-{$endif HAS_MEMORYMANAGER or FPC_NO_DEFAULT_MEMORYMANAGER}
+{$endif HAS_MEMORYMANAGER or FPC_NO_DEFAULT_HEAP}
 end;
 
 {$ifdef FPC_HAS_FEATURE_HEAP}
@@ -166,11 +147,8 @@ procedure fpc_freemem(p:pointer);compilerproc;[public,alias:'FPC_FREEMEM'];
 begin
   MemoryManager.FreeMem(p);
 end;
-{$endif FPC_HAS_FEATURE_HEAP}
-{$endif FPC_IN_HEAPMGR}
-
-{$if (defined(FPC_HAS_FEATURE_HEAP) or defined(FPC_IN_HEAPMGR)) and not defined(HAS_MEMORYMANAGER)}
 
+{$ifndef HAS_MEMORYMANAGER}
 type
 
 {
@@ -1804,7 +1782,6 @@ end;
                                  InitHeap
 *****************************************************************************}
 
-{$ifndef FPC_NO_DEFAULT_HEAP}
 { This function will initialize the Heap manager and need to be called from
   the initialization of the system unit }
 {$ifdef FPC_HAS_FEATURE_THREADING}
@@ -1860,6 +1837,5 @@ begin
 {$endif FPC_HAS_FEATURE_THREADING | defined(HAS_SYSOSFREE)}
 end;
 
-{$endif ndef FPC_NO_DEFAULT_HEAP}
-
-{$endif ndef HAS_MEMORYMANAGER and (defined(FPC_HAS_FEATURE_HEAP) or defined(FPC_IN_HEAPMGR))}
+{$endif ndef HAS_MEMORYMANAGER}
+{$endif FPC_HAS_FEATURE_HEAP}

+ 2 - 10
rtl/inc/heaph.inc

@@ -67,15 +67,7 @@ const
 var
   ReturnNilIfGrowHeapFails : boolean;
 
-{$ifdef EMBEDDED}
-  {$define FPC_NO_DEFAULT_MEMORYMANAGER}
-{$endif EMBEDDED}
-
-{$ifdef FREERTOS}
-  {$define FPC_NO_DEFAULT_MEMORYMANAGER}
-{$endif FREERTOS}
-
-{$ifndef FPC_NO_DEFAULT_MEMORYMANAGER}
+{$ifndef FPC_NO_DEFAULT_HEAP}
 { Default MemoryManager functions }
 Function  SysGetmem(Size:ptruint):Pointer;
 Function  SysFreemem(p:pointer):ptruint;
@@ -86,7 +78,7 @@ function  SysTryResizeMem(var p:pointer;size:ptruint):boolean;
 Function  SysReAllocMem(var p:pointer;size:ptruint):Pointer;
 function  SysGetHeapStatus:THeapStatus;
 function  SysGetFPCHeapStatus:TFPCHeapStatus;
-{$endif FPC_NO_DEFAULT_MEMORYMANAGER}
+{$endif FPC_NO_DEFAULT_HEAP}
 
 {$ifdef FPC_HAS_FEATURE_HEAP}
 { Tp7 functions }

+ 4 - 10
rtl/inc/system.inc

@@ -1232,12 +1232,10 @@ end;
 
 Procedure system_exit;forward;{$ifdef FPC_SYSTEM_EXIT_NO_RETURN}noreturn;{$endif}
 
-{$ifdef FPC_HAS_FEATURE_HEAP}
-{$ifndef HAS_MEMORYMANAGER}
+{$if defined(FPC_HAS_FEATURE_HEAP) and not defined(HAS_MEMORYMANAGER)}
 //not needed if independant memory manager
 Procedure FinalizeHeap;forward;
-{$endif HAS_MEMORYMANAGER}
-{$endif FPC_HAS_FEATURE_HEAP}
+{$endif FPC_HAS_FEATURE_HEAP and not HAS_MEMORYMANAGER}
 
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
 procedure SysFlushStdIO;
@@ -1333,13 +1331,9 @@ Begin
     sysfreemem(cmdline);
 {$endif}
 
-{$ifdef FPC_HAS_FEATURE_HEAP}
-{$ifndef HAS_MEMORYMANAGER}
-{$ifndef FPC_NO_DEFAULT_HEAP}
+{$if defined(FPC_HAS_FEATURE_HEAP) and not defined(HAS_MEMORYMANAGER)}
   FinalizeHeap;
-{$endif not FPC_NO_DEFAULT_HEAP}
-{$endif not HAS_MEMORYMANAGER}
-{$endif FPC_HAS_FEATURE_HEAP}
+{$endif FPC_HAS_FEATURE_HEAP and not HAS_MEMORYMANAGER}
 End;
 
 

+ 2 - 4
rtl/inc/thread.inc

@@ -40,10 +40,8 @@ Var
         SysResetFPU;
 {$endif}
 {$ifndef HAS_MEMORYMANAGER}
-{$ifndef FPC_NO_DEFAULT_HEAP}
         { initialize this thread's heap }
         InitHeapThread;
-{$endif ndef FPC_NO_DEFAULT_HEAP}
 {$else HAS_MEMORYMANAGER}
         if MemoryManager.InitThread <> nil then
           MemoryManager.InitThread();
@@ -81,9 +79,9 @@ Var
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
         if MemoryManager.DoneThread <> nil then
           MemoryManager.DoneThread();
-{$if not defined(HAS_MEMORYMANAGER) and not defined(FPC_NO_DEFAULT_HEAP)}
+{$ifndef HAS_MEMORYMANAGER}
         FinalizeHeap;
-{$endif ndef HAS_MEMORYMANAGER and ndef FPC_NO_DEFAULT_HEAP}
+{$endif ndef HAS_MEMORYMANAGER}
 {$ifdef FPC_HAS_FEATURE_CONSOLEIO}
         { Open all stdio fds again }
         SysFlushStdio;

+ 2 - 6
rtl/inc/threadvr.inc

@@ -116,13 +116,9 @@ begin
    fpc_threadvar_relocate_proc:=RelocProc;
 {$endif FPC_SECTION_THREADVARS}
 
-{$ifdef FPC_HAS_FEATURE_HEAP}
-{$ifndef HAS_MEMORYMANAGER}
-{$ifndef FPC_NO_DEFAULT_HEAP}
+{$if defined(FPC_HAS_FEATURE_HEAP) and not defined(HAS_MEMORYMANAGER)}
    RelocateHeap;
-{$endif ndef FPC_NO_DEFAULT_HEAP}
-{$endif HAS_MEMORYMANAGER}
-{$endif}
+{$endif FPC_HAS_FEATURE_HEAP and not HAS_MEMORYMANAGER}
 end;
 
 

+ 0 - 1
rtl/win16/system.pp

@@ -4,7 +4,6 @@ interface
 
 {$define FPC_IS_SYSTEM}
 {$DEFINE FPC_NO_DEFAULT_HEAP}
-{$DEFINE FPC_NO_DEFAULT_MEMORYMANAGER}
 {$DEFINE HAS_MEMORYMANAGER}
 
 {$DEFINE FPC_INCLUDE_SOFTWARE_MUL}