* fixed the optimizes of daniel

This commit is contained in:
peter 1998-05-22 12:34:06 +00:00
parent cfa06433c6
commit d26106d745
3 changed files with 74 additions and 73 deletions

View File

@ -3,6 +3,8 @@
This file is part of the Free Pascal run time library. This file is part of the Free Pascal run time library.
Copyright (c) 1993,97 by the Free Pascal development team. Copyright (c) 1993,97 by the Free Pascal development team.
Heap management functions
See the file COPYING.FPC, included in this distribution, See the file COPYING.FPC, included in this distribution,
for details about the copyright. for details about the copyright.
@ -12,18 +14,46 @@
**********************************************************************} **********************************************************************}
{
There are three conditionals:
TEMPHEAP to allow to split the heap in two parts for easier release
started for the compiler
USEBLOCKS if you want special allocation for small blocks
CHECKHEAP if you want to test the heap integrity
}
{****************************************************************************
Assembler calls
****************************************************************************}
{$I386_DIRECT}
{$ifndef OS2}
{ OS2 function getheapstart is in sysos2.pas }
function getheapstart : pointer;assembler;
asm
leal HEAP,%eax
end ['EAX'];
{$endif}
function getheapsize : longint;assembler;
asm
movl HEAPSIZE,%eax
end ['EAX'];
function call_heaperror(addr : pointer; size : longint) : integer;assembler;
asm
pushl size
movl addr,%eax
call %eax
end;
{$I386_ATT}
{**************************************************************************** {****************************************************************************
functions for heap management in the data segment functions for heap management in the data segment
****************************************************************************} ****************************************************************************}
{**** 10/06/97 added checkings and corrected some bugs in getmem/freemem ****}
{**** Pierre Muller *********************************************************}
{ three conditionnals here }
{ TEMPHEAP to allow to split the heap in two parts for easier release}
{ started for the compiler }
{ USEBLOCKS if you want special allocation for small blocks }
{ CHECKHEAP if you want to test the heap integrity }
{$IfDef CHECKHEAP} {$IfDef CHECKHEAP}
{ 4 levels of tracing } { 4 levels of tracing }
@ -103,29 +133,6 @@
nblocks : pnblocks; nblocks : pnblocks;
{$ifndef OS2}
{ OS2 function getheapstart is in sysos2.pas }
function getheapstart : pointer;
begin
asm
leal HEAP,%eax
leave
ret
end ['EAX'];
end;
{$endif}
function getheapsize : longint;
begin
asm
movl HEAPSIZE,%eax
leave
ret
end ['EAX'];
end;
function heapsize : longint; function heapsize : longint;
begin begin
@ -500,18 +507,6 @@
label check_new; label check_new;
{$endif CHECKHEAP} {$endif CHECKHEAP}
{ changed to removed the OS conditionnals }
function call_heaperror(addr : pointer; size : longint) : integer;
begin
asm
pushl size
movl addr,%eax
{ movl HEAPERROR,%eax doesn't work !!}
call %eax
movw %ax,__RESULT
end;
end;
var var
last,hp : pfreerecord; last,hp : pfreerecord;
nochmal : boolean; nochmal : boolean;
@ -1053,7 +1048,10 @@ end;
{ {
$Log$ $Log$
Revision 1.4 1998-04-21 10:22:48 peter Revision 1.5 1998-05-22 12:34:06 peter
* fixed the optimizes of daniel
Revision 1.4 1998/04/21 10:22:48 peter
+ heapblocks + heapblocks
Revision 1.3 1998/04/09 08:32:14 daniel Revision 1.3 1998/04/09 08:32:14 daniel

View File

@ -97,7 +97,10 @@ asm
cmpl $7,%ecx cmpl $7,%ecx
jl .LFill1 jl .LFill1
movl %ecx,%edx movl %ecx,%edx
imul $0x01010101,%eax movb %al,%ah
movl %eax,%ebx
shll $16,%eax
movw %bx,%ax
movl %edi,%ecx movl %edi,%ecx
negl %ecx negl %ecx
andl $3,%ecx andl $3,%ecx
@ -105,12 +108,11 @@ asm
rep rep
stosb stosb
movl %edx,%ecx movl %edx,%ecx
andb $3,%dl {Saves some bytes, no speed penalties.} andl $3,%edx
shrl $2,%ecx shrl $2,%ecx
rep rep
stosl stosl
{Ecx is zero.} movl %edx,%ecx
movb %dl,%cl
.LFill1: .LFill1:
rep rep
stosb stosb
@ -118,21 +120,21 @@ end;
{$ifndef RTLLITE} {$ifndef RTLLITE}
procedure fillword(var x;count : longint;value : word);assembler; procedure fillword(var x;count : longint;value : word);assembler;
asm asm
movl x,%edi movl x,%edi
movl count,%ecx movl count,%ecx
movl value,%eax movl value,%eax
{fill EAX with 4 bytes:} movl %eax,%ebx
imul $0x00010001,%eax shll $16,%eax
movl %ecx,%edx movw %bx,%ax
shrl $1,%ecx movl %ecx,%edx
shrl $1,%ecx
cld cld
rep rep
stosl stosl
{Ecx is zero.} {Ecx is zero.}
movb %dl,%cl movb %dl,%cl
andb $1,%cl {Saves some bytes, no speed penalties.} andb $1,%cl {Saves some bytes, no speed penalties.}
rep rep
stosw stosw
end ['EAX','ECX','EDX','EDI']; end ['EAX','ECX','EDX','EDI'];
@ -247,7 +249,7 @@ end;
{ checks for a correct vmt pointer } { checks for a correct vmt pointer }
procedure int_check_obhject;assembler;[public,alias:'CHECK_OBJECT']; procedure int_check_object;assembler;[public,alias:'CHECK_OBJECT'];
asm asm
pushl %edi pushl %edi
movl 8(%esp),%edi movl 8(%esp),%edi
@ -308,9 +310,10 @@ end;
{**************************************************************************** {****************************************************************************
String String
****************************************************************************} ****************************************************************************}
{$I386_ATT}
procedure int_strcopy(len:longint;sstr,dstr:pointer);[public,alias:'STRCOPY']; procedure int_strcopy(len:longint;sstr,dstr:pointer);[public,alias:'STRCOPY'];
{ {
this procedure must save all modified registers except EDI and ESI !!! this procedure must save all modified registers except EDI and ESI !!!
@ -456,7 +459,7 @@ begin
scasb scasb
movl %ecx,%eax movl %ecx,%eax
movl 8(%ebp),%edi movl __RESULT,%edi
notb %al notb %al
decl %eax decl %eax
stosb stosb
@ -501,12 +504,8 @@ end ['EDI','ECX','EAX'];
Function Sptr : Longint;assembler; Function Sptr : Longint;assembler;
asm asm
{Size optimized instead of speed optimized...} movl %esp,%eax
movl %esp,%eax addl $4,%eax
incl %eax
incl %eax
incl %eax
incl %eax
end ['EAX']; end ['EAX'];
@ -707,8 +706,6 @@ begin
end; end;
end; end;
{$I386_ATT}
Function Random(L: LongInt): LongInt;assembler; Function Random(L: LongInt): LongInt;assembler;
asm asm
movl $134775813,%eax movl $134775813,%eax
@ -723,7 +720,10 @@ end;
{ {
$Log$ $Log$
Revision 1.8 1998-05-20 11:01:52 peter Revision 1.9 1998-05-22 12:34:07 peter
* fixed the optimizes of daniel
Revision 1.8 1998/05/20 11:01:52 peter
* .FILL_OBJECT and FILL_OBJECT are not the same names ;) * .FILL_OBJECT and FILL_OBJECT are not the same names ;)
Revision 1.7 1998/05/20 08:09:24 daniel Revision 1.7 1998/05/20 08:09:24 daniel

View File

@ -87,7 +87,7 @@ var
Input, Input,
StdErr : Text; StdErr : Text;
ExitCode, ExitCode,
InOutRes : Longint; InOutRes : Word;
StackBottom, StackBottom,
LowestStack, LowestStack,
RandSeed : Longint; RandSeed : Longint;
@ -332,7 +332,10 @@ Procedure AddExitProc(Proc:TProcedure);
{ {
$Log$ $Log$
Revision 1.6 1998-05-21 19:31:00 peter Revision 1.7 1998-05-22 12:34:11 peter
* fixed the optimizes of daniel
Revision 1.6 1998/05/21 19:31:00 peter
* objects compiles for linux * objects compiles for linux
+ assign(pchar), assign(char), rename(pchar), rename(char) + assign(pchar), assign(char), rename(pchar), rename(char)
* fixed read_text_as_array * fixed read_text_as_array