* compiler defined HEAP and HEAPSIZE removed

This commit is contained in:
peter 2004-10-25 15:38:59 +00:00
parent e7459f5466
commit 869b0ecc85
15 changed files with 161 additions and 447 deletions

View File

@ -143,18 +143,6 @@ var myheapstart:pointer;
heap_handle:longint;
zero:longint;
{ first address of heap }
function getheapstart:pointer;
begin
getheapstart:=myheapstart;
end;
{ current length of heap }
function getheapsize:longint;
begin
getheapsize:=myheapsize;
end;
{ function to allocate size bytes more for the program }
{ must return the first address of new data space or nil if fail }
function Sbrk(size : longint):pointer;
@ -550,7 +538,10 @@ begin
end.
{
$Log$
Revision 1.16 2004-09-18 11:18:44 hajny
Revision 1.17 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.16 2004/09/18 11:18:44 hajny
* handle type changed to thandle in do_isdevice
Revision 1.15 2004/09/03 19:25:32 olle

View File

@ -80,29 +80,6 @@ Begin
randseed:=longint(Fptime(nil));
End;
{*****************************************************************************
Heap Management
*****************************************************************************}
var
_HEAP : longint;external name 'HEAP';
_HEAPSIZE : longint;external name 'HEAPSIZE';
{$ifndef SYSTEM_HAS_GETHEAPSTART}
function getheapstart:pointer;
begin
getheapstart := @_HEAP;
end;
{$endif}
{$ifndef SYSTEM_HAS_GETHEAPSIZE}
function getheapsize:longint;
begin
getheapsize := _HEAPSIZE;
end;
{$endif}
{*****************************************************************************
Low Level File Routines
@ -593,7 +570,10 @@ end;
{
$Log$
Revision 1.15 2004-07-17 15:20:55 jonas
Revision 1.16 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.15 2004/07/17 15:20:55 jonas
* don't use O_CREATE when opening a file for appending (fixes tw1744)
Revision 1.14 2004/05/16 18:51:20 peter

View File

@ -289,7 +289,7 @@ function sbrk(size:longint):pointer;
var
L: longword;
begin
WriteLn ('Trying to grow heap by ', Size, ' to ', HeapSize + Size);
WriteLn ('Trying to grow heap by ', Size);
{$IFDEF CONTHEAP}
WriteLn ('BrkLimit is ', BrkLimit);
{$ENDIF CONTHEAP}
@ -323,18 +323,6 @@ asm
end {['eax', 'edx']};
{$ENDIF DUMPGROW}
function getheapstart:pointer;assembler;
asm
movl heap_base,%eax
end {['EAX']};
function getheapsize:longint;assembler;
asm
movl heap_brk,%eax
end {['EAX']};
function SysOSAlloc (Size: ptrint): pointer;
begin
SysOSAlloc := Sbrk (Size);
@ -1333,7 +1321,10 @@ begin
end.
{
$Log$
Revision 1.28 2004-09-18 11:12:49 hajny
Revision 1.29 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.28 2004/09/18 11:12:49 hajny
* handle type changed to thandle in do_isdevice
Revision 1.27 2004/09/03 19:25:41 olle

View File

@ -1329,13 +1329,16 @@ begin
freelist_var := nil;
freeoslist := nil;
freeoslistcount := 0;
internal_heapsize := GetHeapSize;
internal_memavail := internal_heapsize;
internal_heapsize := 0;
internal_memavail := 0;
end;
{
$Log$
Revision 1.36 2004-08-10 18:58:36 jonas
Revision 1.37 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.36 2004/08/10 18:58:36 jonas
* changed formatting to conform to the rest of the compiler/rtl
* fixed SysMaxAvail so it also looks at the free fixed size blocks

View File

@ -722,6 +722,12 @@ var
edata : longword; external name 'edata';
{$endif go32v2}
{$ifdef linux}
var
etext: ptruint; external name '_etext';
edata : ptruint; external name '_edata';
{$endif}
procedure CheckPointer(p : pointer);{$ifndef NOSAVEREGISTERS}saveregisters;{$endif}[public, alias : 'FPC_CHECKPOINTER'];
var
@ -766,6 +772,19 @@ begin
goto _exit;
{$endif win32}
{$ifdef linux}
{ inside stack ? }
asm
movl %ebp,get_ebp
end;
if (ptruint(p)>get_ebp) and
(ptruint(p)<$c0000000) then //todo: 64bit!
goto _exit;
{ inside data ? }
if (ptruint(p)>=ptruint(@etext)) and (ptruint(p)<ptruint(@edata)) then
goto _exit;
{$endif linux}
{ first try valid list faster }
{$ifdef EXTRA}
@ -1138,7 +1157,10 @@ finalization
end.
{
$Log$
Revision 1.34 2004-10-24 20:01:41 peter
Revision 1.35 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.34 2004/10/24 20:01:41 peter
* saveregisters calling convention is obsolete
Revision 1.33 2004/09/21 14:49:29 peter

View File

@ -82,30 +82,6 @@ Begin
End;
{*****************************************************************************
Heap Management
*****************************************************************************}
var
_HEAP : longint;external name 'HEAP';
_HEAPSIZE : longint;external name 'HEAPSIZE';
{$ifndef SYSTEM_HAS_GETHEAPSTART}
function getheapstart:pointer;
begin
getheapstart := @_HEAP;
end;
{$endif}
{$ifndef SYSTEM_HAS_GETHEAPSIZE}
function getheapsize:longint;
begin
getheapsize := _HEAPSIZE;
end;
{$endif}
{*****************************************************************************
Low Level File Routines
*****************************************************************************}
@ -589,7 +565,10 @@ end;
{
$Log$
Revision 1.20 2004-08-04 19:27:09 florian
Revision 1.21 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.20 2004/08/04 19:27:09 florian
* fixed floating point and integer exception handling on sparc/linux
Revision 1.19 2004/05/31 20:25:04 peter

View File

@ -378,27 +378,6 @@ begin
randseed:= Cardinal(TickCount);
end;
{*****************************************************************************
Heap Management
*****************************************************************************}
var
{ Pointer to a block allocated with the MacOS Memory Manager, which
is used as the initial FPC heap. }
theHeap: Mac_Ptr;
intern_heapsize : longint;external name 'HEAPSIZE';
{ first address of heap }
function getheapstart:pointer;
begin
getheapstart:= theHeap;
end;
{ current length of heap }
function getheapsize:longint;
begin
getheapsize:= intern_heapsize ;
end;
{*****************************************************************************
OS Memory allocation / deallocation
@ -1191,11 +1170,6 @@ begin
{ Setup heap }
if StandAlone <> 0 then
MaxApplZone;
if Mac_FreeMem - intern_heapsize < 30000 then
Halt(3); //exit code 3 according to MPW
theHeap:= NewPtr(intern_heapsize);
if theHeap = nil then
Halt(3); //exit code 3 according to MPW
InitHeap;
SysInitExceptions;
@ -1225,7 +1199,10 @@ end.
{
$Log$
Revision 1.23 2004-10-19 19:56:59 olle
Revision 1.24 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.23 2004/10/19 19:56:59 olle
* Interface to StdLibC moved from system to macostp
Revision 1.22 2004/09/30 19:58:42 olle

View File

@ -429,40 +429,13 @@ begin
end;
{*****************************************************************************
Heap Management
*****************************************************************************}
var
int_heap : LongInt; external name 'HEAP';
int_heapsize : LongInt; external name 'HEAPSIZE';
{ first address of heap }
function getheapstart:pointer;
begin
getheapstart:=@int_heap;
end;
{ current length of heap }
function getheapsize:longint;
begin
getheapsize:=int_heapsize;
end;
{ function to allocate size bytes more for the program }
{ must return the first address of new data space or nil if fail }
function Sbrk(size : longint):pointer;
begin
Sbrk:=AllocPooled(MOS_heapPool,size);
end;
{*****************************************************************************
OS Memory allocation / deallocation
****************************************************************************}
function SysOSAlloc(size: ptrint): pointer;
begin
result := sbrk(size);
result := AllocPooled(MOS_heapPool,size);
end;
{$define HAS_SYSOSFREE}
@ -918,7 +891,10 @@ end.
{
$Log$
Revision 1.19 2004-09-03 19:26:15 olle
Revision 1.20 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.19 2004/09/03 19:26:15 olle
+ added maxExitCode to all System.pp
* constrained error code to be below maxExitCode in RunError et. al.

View File

@ -251,24 +251,6 @@ end;
Heap Management
*****************************************************************************}
var
heap : longint;external name 'HEAP';
intern_heapsize : longint;external name 'HEAPSIZE';
{ first address of heap }
function getheapstart:pointer;
assembler;
asm
leal HEAP,%eax
end ['EAX'];
{ current length of heap }
function getheapsize:longint;
assembler;
asm
movl intern_HEAPSIZE,%eax
end ['EAX'];
{$ifdef autoHeapRelease}
const HeapInitialMaxBlocks = 32;
@ -985,7 +967,10 @@ Begin
End.
{
$Log$
Revision 1.27 2004-09-26 19:25:49 armin
Revision 1.28 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.27 2004/09/26 19:25:49 armin
* exiting threads at nlm unload
Revision 1.26 2004/09/17 18:29:07 armin

View File

@ -242,22 +242,6 @@ end;
Heap Management
*****************************************************************************}
var
int_heap : pointer;external name 'HEAP';
int_heapsize : longint;external name 'HEAPSIZE';
{ first address of heap }
function getheapstart:pointer;
begin
getheapstart := int_heap;
end;
{ current length of heap }
function getheapsize:longint;
begin
getheapsize := int_heapsize;
end;
{$ifdef autoHeapRelease}
const HeapInitialMaxBlocks = 32;
@ -1194,7 +1178,10 @@ Begin
End.
{
$Log$
Revision 1.4 2004-09-26 19:23:34 armin
Revision 1.5 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.4 2004/09/26 19:23:34 armin
* exiting threads at nlm unload
* renamed some libc functions

View File

@ -487,98 +487,10 @@ function DosFreeMem (P: pointer): cardinal; cdecl;
external 'DOSCALLS' index 304;
var
{ Int_Heap_End: pointer;}
Int_Heap: pointer;
{$IFNDEF VER1_0}
external name 'HEAP';
{$ENDIF VER1_0}
Int_HeapSize: cardinal; external name 'HEAPSIZE';
HighMemSupported: boolean;
{ PreviousHeap: cardinal;
AllocatedMemory: cardinal;
Int_Heap : Pointer;
Int_heapSize : longint;
function GetHeapSize: longint;
begin
GetHeapSize := PreviousHeap + longint (Int_Heap_End) - longint (Int_Heap);
end;
}
function GetHeapSize: longint; assembler;
asm
movl Int_HeapSize, %eax
end ['EAX'];
(*
function Sbrk (Size: longint): pointer;
var
P: pointer;
RC: cardinal;
const
MemAllocBlock = 4 * 1024 * 1024;
begin
{ $IFDEF DUMPGROW}
WriteLn ('Trying to grow heap by ', Size, ' to ', HeapSize + Size);
{ $ENDIF}
// commit memory
RC := DosSetMem (Int_Heap_End, Size, $13);
if RC <> 0 then
( * Not enough memory was allocated - let's try to allocate more
(4 MB steps or as much as requested if more than 4 MB needed). * )
begin
if Size > MemAllocBlock then
begin
RC := DosAllocMem (P, Size, 3);
if RC = 0 then Inc (AllocatedMemory, Size);
end
else
begin
RC := DosAllocMem (P, MemAllocBlock, 3);
if RC = 0 then Inc (AllocatedMemory, MemAllocBlock);
end;
if RC = 0 then
begin
PreviousHeap := GetHeapSize;
Int_Heap := P;
Int_Heap_End := P;
RC := DosSetMem (Int_Heap_End, Size, $13);
end
else
begin
Sbrk := nil;
{ $IFDEF DUMPGROW}
WriteLn ('Error ', RC, ' during additional memory allocation!');
WriteLn ('Total allocated memory is ', cardinal (AllocatedMemory), ', ',
GetHeapSize, ' committed.');
{ $ENDIF DUMPGROW}
Exit;
end;
end;
if RC <> 0 then
begin
{ $IFDEF DUMPGROW}
WriteLn ('Error ', RC, ' while trying to commit more memory!');
WriteLn ('Current memory object starts at ', cardinal (Int_Heap),
' and committed until ', cardinal (Int_Heap_End));
WriteLn ('Total allocated memory is ', cardinal (AllocatedMemory), ', ',
GetHeapSize, ' committed.');
{ $ENDIF DUMPGROW}
Sbrk := nil;
end
else
begin
Sbrk := Int_Heap_End;
{ $IFDEF DUMPGROW}
WriteLn ('New heap at ', cardinal (Int_Heap_End));
{ $ENDIF DUMPGROW}
Inc (Int_Heap_End, Size);
end;
end;
*)
{$IFDEF DUMPGROW}
{$DEFINE EXTDUMPGROW}
{$ENDIF DUMPGROW}
@ -589,8 +501,7 @@ var
RC: cardinal;
begin
{$IFDEF EXTDUMPGROW}
WriteLn ('Trying to grow heap by ', Size, ' to ', Int_HeapSize
+ cardinal (Size));
WriteLn ('Trying to grow heap by ', Size);
{$ENDIF}
if HighMemSupported then
@ -663,12 +574,6 @@ begin
{$ENDIF EXTDUMPGROW}
end;
function GetHeapStart: pointer;
begin
GetHeapStart := Int_Heap;
end;
{$i heap.inc}
@ -1621,7 +1526,10 @@ begin
end.
{
$Log$
Revision 1.74 2004-09-18 11:12:09 hajny
Revision 1.75 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.74 2004/09/18 11:12:09 hajny
* handle type changed to thandle in do_isdevice
Revision 1.73 2004/09/11 19:43:11 hajny

View File

@ -108,30 +108,6 @@ Begin
End;
{*****************************************************************************
Heap Management
*****************************************************************************}
var
_HEAP : longint;external name 'HEAP';
_HEAPSIZE : longint;external name 'HEAPSIZE';
{$ifndef SYSTEM_HAS_GETHEAPSTART}
function getheapstart:pointer;
begin
getheapstart := @_HEAP;
end;
{$endif}
{$ifndef SYSTEM_HAS_GETHEAPSIZE}
function getheapsize:longint;
begin
getheapsize := _HEAPSIZE;
end;
{$endif}
{*****************************************************************************
Low Level File Routines
*****************************************************************************}
@ -655,7 +631,10 @@ End.
*)
{
$Log$
Revision 1.7 2002-11-14 12:18:03 marco
Revision 1.8 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.7 2002/11/14 12:18:03 marco
* fixed sys_time call to (NIL)
Revision 1.6 2002/10/27 17:21:29 marco

View File

@ -112,40 +112,6 @@ begin
randseed:=0;
end;
{*****************************************************************************
Heap Management
*****************************************************************************}
{ first address of heap }
function getheapstart:pointer;{assembler;
asm
leal HEAP,%eax
end ['EAX'];}
begin
getheapstart:=0;
end;
{ current length of heap }
function getheapsize:longint;{assembler;
asm
movl HEAPSIZE,%eax
end ['EAX'];}
begin
getheapsize:=0;
end;
{ function to allocate size bytes more for the program }
{ must return the first address of new data space or nil if fail }
function Sbrk(size : longint):pointer;{assembler;
asm
movl size,%eax
pushl %eax
call ___sbrk
addl $4,%esp
end;}
begin
Sbrk:=nil;
end;
{*****************************************************************************
OS Memory allocation / deallocation
@ -153,7 +119,7 @@ end;
function SysOSAlloc(size: ptrint): pointer;
begin
result := sbrk(size);
// code to allocate memory block
end;
// If the OS is capable of freeing memory, define HAS_SYSOSFREE and implement
@ -320,7 +286,10 @@ Begin
End.
{
$Log$
Revision 1.12 2004-09-03 19:26:57 olle
Revision 1.13 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.12 2004/09/03 19:26:57 olle
+ added maxExitCode to all System.pp
* constrained error code to be below maxExitCode in RunError et. al.

View File

@ -827,27 +827,14 @@ begin
randseed:=hl*$10000+ lo(regs.realecx);
end;
{*****************************************************************************
Heap Management
*****************************************************************************}
var int_heapsize:longint; external name 'HEAPSIZE';
int_heap:pointer; external name 'HEAP';
function getheapstart:pointer;
begin
getheapstart:=int_heap;
end;
function getheapsize:longint;
begin
getheapsize:=int_heapsize;
end;
OS Memory allocation / deallocation
****************************************************************************}
function ___sbrk(size:longint):pointer;cdecl; external name '___sbrk';
function Sbrk(size : longint):pointer;assembler;
function SysOSAlloc(size: ptrint): pointer;assembler;
asm
{$ifdef SYSTEMDEBUG}
cmpb $1,accept_sbrk
@ -865,20 +852,10 @@ asm
{$endif}
end;
{*****************************************************************************
OS Memory allocation / deallocation
****************************************************************************}
function SysOSAlloc(size: ptrint): pointer;
begin
result := sbrk(size);
end;
{$define HAS_SYSOSFREE}
{ define HAS_SYSOSFREE}
procedure SysOSFree(p: pointer; size: ptrint);
begin
fpmunmap(p, size);
end;
{ include standard heap management }
@ -1554,7 +1531,10 @@ End.
{
$Log$
Revision 1.15 2004-09-03 19:27:16 olle
Revision 1.16 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.15 2004/09/03 19:27:16 olle
+ added maxExitCode to all System.pp
* constrained error code to be below maxExitCode in RunError et. al.

View File

@ -265,22 +265,6 @@ end;
stdcall;external 'kernel32' name 'HeapSize';
{$ENDIF}
var
heap : longint;external name 'HEAP';
intern_heapsize : longint;external name 'HEAPSIZE';
function getheapstart:pointer;
assembler;
asm
leal HEAP,%eax
end ['EAX'];
function getheapsize:longint;
assembler;
asm
movl intern_HEAPSIZE,%eax
end ['EAX'];
{*****************************************************************************
OS Memory allocation / deallocation
@ -1622,7 +1606,10 @@ end.
{
$Log$
Revision 1.61 2004-09-03 19:27:25 olle
Revision 1.62 2004-10-25 15:38:59 peter
* compiler defined HEAP and HEAPSIZE removed
Revision 1.61 2004/09/03 19:27:25 olle
+ added maxExitCode to all System.pp
* constrained error code to be below maxExitCode in RunError et. al.