mORMot Enhanced Run Time library for Delphi 7 - Delphi 2007 (Full Patched Source Code)

c5soft

端茶倒水的
管理成员
Administrator
Registered
Moderator
Life Time Member
VIP Member
GUEST, unregistred user!
注册
2015-06-01
消息
132
Enhanced Run Time library for Delphi 7 - Delphi 2007
----------------------------------------------------


Purpose of these files is to provide speed and bug corrections to the
Run Time Library and the VCL of Delphi 7 and 2007.

Written by Arnaud Bouchez in 2008-2010
http://synopse.info



1. Copyright

Original Source code remains on following copyright:
Copyright (c) 1988, 2001 Borland Software Corporation

A.Bouchez disclaims copyright to the modifications made to the original code.
In place of a legal notice, here is a blessing (from SQLite3 licence):
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.


2. Installation

These files are hacked low-level source code, extracted from the original
Delphi 7 and 2007 run time libray and VCL.

In order to install them, you MUST have a true Delphi 7/2007 installation in your
PC, then launch the SynopseRTL.EXE file. This file will check for the Delphi source
files and ask for a destination folder. Keep the destination Directory name short
(aka D:\Dev\Lib) for easy maintenability. Then launch syscomp.bat to compile
the enhanced special System.dcu and SysInit.dcu files.
The original source files are needed: this installation package only contains
the diffs made to these files.

In order to use the enhanced files, you must change your Delphi settings, and
place the new files to be look up by the Delph compiler BEFORE the default ones
(in C:\Program Files\Borland\Delphi7):
- for the IDE, make sure that the new directory (e.g. D:\Dev\Lib) is the FIRST
in all paths ("Library" tab of the global Options), before $(DELPHI)\Lib: a
valid parameter is "d:\dev\lib;$(DELPHI)\Lib;$(DELPHI)\Bin;...." or
"d:\Dev\Lib;$(DELPHI)\source\vcl;$(DELPHI)\Source\Rtl;...."
- for the command line compiler, change the dcc32.cfg -u flag content in the
C:\Program Files\Borland\Delphi7\Bin directory into this:
-ud:\dev\lib;"C:\Program Files\Borland\Delphi7\lib"
or use a custom bat file file the proper -ud:\dev\lib command line to dcc32.exe

These files are needed for the Synopse SQLite3 framework to compile. If you
don't want to hack your compiler, copy System.dcu and SysInit.dcu files into your
Synopse SQLite3 framework program directory.

I managed to get this RTL work with Delphi 2007. Only System.pas and SysInit.pas
are supplied (and needed) for Delphi 2007. Even if some John O'Harrow or Pierre
Le Riche modifications are already included in Delphi 2007, some of my tricks are
unique and could be usefull (see below).
Only Delphi 7 and Delphi 2007 patches exists till now, since I need the original
source files, in order to create the patches (by design). :)

Enjoy!


3. System.pas enhancements (Delphi 7 and Delphi 2007)

- included John O'Harrow version of move() fillchar() Pos() Val() and Int64 math
- included Pierre Le Riche fast _LStrCmp() implementation
- deprecated Japan Nec computer bug prevention under Win95 is removed
- shortstring delete() copy() now use move() and not slow "rep movsb/movsd"
- borland memory manager is removed and replaced with windows heap manager:
we recommend using FastMM4 explicitely for VCL applications (as Delphi 2009),
and leave as it is for smaller executables (e.g. for LVCL; the windows
heap manager is slower than FastMM4, but sufficient for GUI small apps)
- there is an optional FastMM4 memory manager inside our getmem.inc, which can
be enabled by undefining HEAPMEMMANAGER conditional in getmem.inc:
this FastMM4 shares its memory for the same process with external .DLL
(if both EXE and DLL are compiled with undefined HEAPMEMMANAGER conditional)
- some common functions implemented in asm (_Getmem, _Freemem, IOResult...)
- very common internal basic methods rewritten or improved:
TObject.NewInstance/InitInstance/InheritsFrom/_AfterConstruction/
GetDynaMethod/ClassName...
- on new multi-core CPU, avoid lock asm usage for strings and dynamic arrays
if no TThread is used (default $define AVOIDLOCK): faster with high-end PC
- record and object initialization and finalization rewritten for speed:
_InitializeArray, _FinalizeArray, _InitializeRecord, _FinalizeRecord
- resourcestring are cached (default $define LOADRESSTRINGCACHED)
- resourcestring can be translated on the fly with the global
LoadResStringTranslate procedure pointer (this feature is used in the
SQLite3i18n unit)
- widestring allocation can be cached (if $define CACHE_WIDESTRINGS is set)
(with Vista, the caching is always disabled, since this OS is much faster
than the previous) but you must call explicitely InitWideStringOptimize
to launch caching, in order to use the right heap manager (if you intend
to use FastMM4 e.g.)
- asm code: 'rep ret' optimization avoid branch misprediction for AMD64 CPUs
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25112.PDF
see '6.2 Two-Byte Near-Return RET Instruction', page 128
- asm code XOR reg32,reg32 + MOV reg8,* is changed to faster MOVZX reg32,*
- a special version is compiled with the LVCL define flag, for even smaller code
- Linux/Kylix compatibility:
. can be compiled with the command-line compiler (tested with crosskylix)
. codepage is fixed to ISO-8859-1: widestring is available with configuration
like LANG=*.UTF-8, which is the standard nowadays for modern distros


4. SysUtils.pas enhancements (Delphi 7 and Delphi 2007)

- NormToLower[] and NormToUpper[] tables to fast character case conversion
- TwoDigitLookup[] table for fast 0..99 to '00'..'99' conversion
- HexChars[] for fast 0..15 to '0'..'f' conversion
- Ansi*() functions use NormToLower[] and NormToUpper[]:
call i18n unit and i18n*() functions for using current locale
- some common functions are faster than default Borland's implementation:
CompareText() SameText() UpperCase() IntToStr() DecodeTime() DecodeDate()
StrLen() StrComp() StrIComp() StrEnd()
and avoid use of slow PIC specific code or lodsb/stosb asm opcodes in asm


5. Classes.pas enhancements (Delphi 7)

- faster TReader.Read() and TCustomMemoryStream.Seek()
- faster TList.Get(), TCollection.GetItem() and TStringList.Get()
- under Linux, avoid variants usage for speed up and code size


6. Contnrs.pas enhancements (Delphi 7)

- faster TObjectList TComponentList TClassList Items[] read property


7. ComCtrls.pas enhancements (Delphi 7)

- fix the VCL TDateTimePicker checkbox handling bug for Windows Vista


8. Grids.pas enhancements (Delphi 7)

- fix issue: Grid flickers with active theming
- use XP Themes for fixed cells if enabled


9. Printer.pas enhancements (Delphi 7)

- allows raw customization of low level parameters:
. create a TPrinterNew instance instead of a TPrinter
. access to color/black&white or duplex mode e.g. with PrinterNew function
. we have to subclass TPrinter inside this unit, because Borland
made the key properties and methods of the class private :(


10. IniFiles.pas enhancements (Delphi 7)

- faster hash implementation (in asm) - exact same hashing algorythm and value
- round Hash buffer Size to a power of two (faster hashing calculation)


11. TypInfo.pas enhancements (Delphi 7)

- under Linux, avoid variants usage for speed up and code size
 

附件

Similar threads

A
回复
0
查看
987
Andreas Hausladen
A
A
回复
0
查看
938
Andreas Hausladen
A
A
回复
0
查看
613
Andreas Hausladen
A
A
回复
0
查看
813
Andreas Hausladen
A
A
回复
0
查看
538
Andreas Hausladen
A
后退
顶部