#1 2010-06-21 17:03:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Enhanced System Run Time for Delphi 7 and Delphi 2007

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

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 / 2007 run time libray and VCL.
Download the self-installing package according to your current Delphi 7 or Delphi 2007 version.
In order to install them, you MUST have a true Delphi 7/2007 installation in your PC (or at least the original Delphi 7 installation CD), then launch the corresponding patcher file. This file will check for the original Delphi 7/2007 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 expected file and date of the Delphi 7 Source files are September 2002, October 2002, or April 2004.
According to Borland/CodeGear/Embarcadero copyright, the original source files are needed: these installation packages only contain the diffs made to these files.

In the text below, the installation is intended for Delphi 7. For Delphi 2007, change the directories according to your current configuration.

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 could be modified to enhance also newer version of Delphi, since the RTL files didn't change a lot until Delphi 2009 compiler version.

These files are not needed for the Synopse SQLite3 framework to compile. But with these modified files, the framework works even better and faster.

If you don't want to hack your compiler, copy System.dcu and SysInit.dcu files into the source code directory of your project: the IDE will use it to build the executable.

Update: now the files were modified to run with Delphi 2007.

3. System.pas (and SysInit.pas) enhancements

- 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 integrated 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, TObject.InitInstance, TObject.InheritsFrom, TObject._AfterConstruction, TObject.GetDynaMethod (used a lot in the VCL), TObject.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, since such a LOCK freezes all the cores and delay the code execution a lot
- record and object initialization and finalization rewritten for speed: _InitializeArray, _FinalizeArray, _InitializeRecord, _FinalizeRecord functions
- cached resourcestring (default $define LOADRESSTRINGCACHED)
- resourcestring can be translated on the fly with the global LoadResStringTranslate procedure pointer (this feature is used in the SQLite3i18n unit)
- cached widestring allocation (if the conditional $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 explicitly 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 modern CPU pipeline branch misprediction; see AMD64 document § '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; you can download the LVCL framework in LVCL.zip
- Linux/Kylix compatibility:
. can be compiled with the command-line compiler (tested with crosskylix)
. system codepage is fixed to ISO-8859-1: widestring is available with configuration like LANG=*.UTF-8, which is the standard nowadays for modern distros
- a Delphi 2007 patcher also exists.

Note: Delphi 2007 only have an enhanced System.pas unit - all the units below are NOT available for Delphi 2007, only for Delphi 7.

4. SysUtils.pas enhancements

- 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()
- avoid use of slow PIC specific code or lodsb/stosb asm opcodes in asm for format() and such

5. Classes.pas enhancements
- 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
- faster TObjectList TComponentList TClassList Items[] read property

7. ComCtrls.pas enhancements
- fix the VCL TDateTimePicker checkbox handling bug for Windows Vista

8. Grids.pas enhancements
- fix Grid flickers with active theming
- can use XP Themes for fixed cells if enabled

9. Printer.pas enhancements
- 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
- faster hash implementation (in asm)
- round Hash buffer Size to a power of two (faster hashing calculation)

11. TypInfo.pas enhancements
- under Linux, avoid variants usage for speed up and code size


In order to check which version you must download, go to the source folder of your distribution (go to you distribution CD and browse the folders into the program files\Borland\Delphi7\Source\Rtl\Sys\ folder, or the corresponding directory on your running installation), and check the System.pas file date.

If the System.pas file month and year are 08/2002, download http://synopse.info/files/SynopseRTL082002.exe

If the System.pas file month and year are 09/2002, download http://synopse.info/files/SynopseRTL092002.exe

If the System.pas file month and year are 04/2004, you should have already applied the 7.1 update: try to download http://synopse.info/files/SynopseRTL042004.exe

You can download the compiled System.dcu and SysInit.dcu (for Delphi 7) from http://synopse.info/files/SynopseRTLdcu.zip.

The patcher for Delphi 2007 System.pas and SysInit.pas is http://synopse.info/files/SynopseRTL2007.exe.

These updated System.pas and SysInit.pas files should work with every version of the Delphi compiler, from 3 to 2007 (not Delphi 2009/2010, since the Unicode changed a lot the way these files did exist). I've only checked Delphi 7 and Delphi 2007. So if you were able to use them with other Delphi compiler versions, send me some feed back, please!

Offline

#2 2010-07-03 15:53:07

longge007
Member
Registered: 2010-06-22
Posts: 107

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

can you help me find where is my Installation Error?
Step: 1) i download SynopseRTL2007.exe, click it, set valide source files "E:\Program Files\CodeGear\RAD Studio\5.0\source\Win32",and destination directory is default dir "D:\dev\lib",
2) then install,
3) modify syscomp.bat content. New is:

del *.dcu /s
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -$D+ System.pas
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -NLVCL -$D+ System.pas
"E:\Program Files\CodeGear\RAD Studio\5.0\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -N..\ictus3\LVCL -$D+ System.pas
pause

4) run syscomp.bat
5)set IDE LIb path.My IDE is Delphi2007, add Lib paths :
D:\Dev\Lib;$(BDS)\lib;$(BDSUSERDIR)\Imports;$(BDS)\Imports;$(BDS)\Lib\Indy10;$(BDSCOMMONDIR)\Dcp

6)new-> VCL forms Application-delphi for win32.
7) compile project1
8) Error: [DCC Error] Project1.dpr(5): F2051 Unit SysUtils was compiled with a different version of System.@LStrLen
MY complier version is Delphi2007, OS:WIN7
what' the matter

Offline

#3 2010-08-04 04:23:08

AdamWu
Member
Registered: 2010-07-22
Posts: 20

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

If you recompile system.pas, then you will need to recompile every single source in the runtime to make it match with the modified system.pas.
Every one of them.

Offline

#4 2010-10-14 06:14:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

AdamWu wrote:

If you recompile system.pas, then you will need to recompile every single source in the runtime to make it match with the modified system.pas.
Every one of them.

It's true only if the interface part of the unit changed.
So it may be the case for Delphi 2007, but there is no need to recompile all units in our Enhanced RTL for Delphi 7.

Offline

#5 2010-10-29 11:36:40

TPrami
Member
Registered: 2010-07-06
Posts: 69

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Hello,

Would it be possible to have your new versions in some kind of test file or in .pas file. '

So I could check some out and maybe patch some D6 methods by hand etc... (Or D2007)...

Because Most likely I can't use whole update, but some could help me a lot...

-TP-

Offline

#6 2010-10-29 12:26:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I don't have the right to do that... according to Borland/Embarcadero license...
Sorry sad

Are you not able to get the original Delphi 7 files, from an old CD?

Offline

#7 2011-01-20 09:06:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Starkis wrote:

Hope that makes overall installation process clearler smile

Currently, this bat file looks like this:

del *.dcu /s
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -$D+ System.pas 
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -NLVCL -$D+ System.pas 
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -N..\ictus3\LVCL -$D+ System.pas 
pause

It's just provided as a sample, for my particular development folder architecture, with both LVCL and Ictus3\LVCL additional folders.

Hacking the System RTL is some low-level stuff, which should be done only by people how know what they are doing.
I don't want to hack the default Delphi installation in an automated manner.

The folders have to be changed in the IDE configuration, and also in the command line compiler.
People how don't know how it works will continue to use the default system.dcu/sysutils.dcu.
At least, it won't introduce any regression problem.

I provided the syscom.bat file only to show the right command line switchs to be used (-O+ -Q -M -Y -Z -$D+). Because they are not well documented.
But this is definitively not an installation procedure.

So things are "more difficult than they are", it's on purpose. To avoid unaware people breaking their Delphi installation.
With Vista/Seven around, there are several way of installing Dephi 7/2007... so I'm not sure an automated installation will fit all particularities.

Offline

#8 2011-01-20 14:26:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Thanks for your interest and experience sharing, in all cases!

And "bravo" for having set up enhanced RTL!
smile

Offline

#9 2011-01-30 09:07:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

About speed enhancements, see the impact of the Enhanced RTL library, when we benchmarked SynScaleMM:
http://blog.synopse.info/post/2010/12/04/SynScaleMM

Offline

#10 2011-11-25 12:33:24

vavan
Member
Registered: 2011-11-25
Posts: 1

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

downloaded and ran SynopseRTL2007.exe
set C:\BDS5\source in "Delphi Source Files" and got error "Invalid Source directory"

Offline

#11 2011-11-25 13:08:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I'll reply to your by email.

Offline

#12 2011-12-11 11:41:20

errorsys
Member
Registered: 2011-12-11
Posts: 1

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I have the same problem, my Delphi (BDS) system.pas full path is: d:\Program Files\Borland\BDS\4.0\source\Win32\rtl\sys\
Please help!

Offline

#13 2012-02-02 10:52:11

Alex7691
Member
Registered: 2012-02-01
Posts: 4

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Hi Folks!

I've successfully patched Delphi 7 sources but I want to use the Enhanced System Run Time in Delphi 2006 (BDS 2006). Anybody did it already?

Best regards

Offline

#14 2012-02-02 15:17:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I did not have Delphi 2006 installed.
I've made some changes in order to work with Delphi 2007 for some part, but it is not fully tested.
Sorry...

Offline

#15 2012-02-02 16:57:44

Alex7691
Member
Registered: 2012-02-01
Posts: 4

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

I did not have Delphi 2006 installed.
I've made some changes in order to work with Delphi 2007 for some part, but it is not fully tested.
Sorry...

Ok Arnaud, Thanks for your response. I'm using some of your code to patch my BDS 2006 RTL, ok? :-)

BTW, I've successfully compiled and tested your SynScaleMM in a rather complex Intraweb application. I will do some performance and stress test and let you know the results.

Best Regards!

Offline

#16 2012-04-09 19:05:30

Starkis
Member
From: Up in the space
Registered: 2011-01-16
Posts: 26

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

is this somehow related with the Enhanced RTL:

[Error] SysUtils.pas(5348): Undeclared identifier: 'LoadResStringTranslate'
[Error] SysUtils.pas(5348): Incompatible types
[Fatal Error] Test.dpr(168): Could not compile used unit 'SysUtils.pas'

when have turned use debug DCUs on for a project? maybe some Enhanced RTL instalation were skipped?

Last edited by Starkis (2012-04-11 12:43:20)


--- we no need no water, let the ... burn ---

Offline

#17 2012-05-23 12:59:10

Starkis
Member
From: Up in the space
Registered: 2011-01-16
Posts: 26

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Starkis wrote:

is this somehow related with the Enhanced RTL:
[Error] SysUtils.pas(5348): Undeclared identifier: 'LoadResStringTranslate'
[Error] SysUtils.pas(5348): Incompatible types
[Fatal Error] Test.dpr(168): Could not compile used unit 'SysUtils.pas'

seems to be related to the alignment value difference for the compiled Enhanced RTL and project (1 vs 8)


--- we no need no water, let the ... burn ---

Offline

#18 2012-05-23 16:55:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I do not think this is the root cause.

The debug DCUs are only available for the "official" RTL.
They are not compatible with the Enhanced RTL.
In order to debug the RTL, you have to modify the units source and go step by step.

Offline

#19 2012-10-04 19:33:36

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

make sure that the new directory (e.g. D:\Dev\Lib) is the FIRST in all paths

This recommended way of installing these units causes a problem with the Jedi JVCL installer (http://wiki.delphi-jedi.org/wiki/JEDI_V … nt_Library): it appears to be designed to always find the original Delphi units first, so when one tries to build an application the following error occurs:

Unit JvJVCLUtils was compiled with a different version of Grids.TCustomDrawGrid

Can anyone suggest a simple solution?

Offline

#20 2012-10-04 20:01:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Perhaps replace the Grids.dcu and other units in Delphi/... sub folder with the Enhanced RTL version.
Or change the dcc32.cfg path in Delphi/bin to also first point at the enhanced RTL directory, just like the IDE.

I suspect the JVCL installer does not use the IDE path, but use the default dcc32.cfg file.

Offline

#21 2012-10-04 20:19:40

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

Perhaps replace the Grids.dcu and other units in Delphi/... sub folder with the Enhanced RTL version.

Yes, that's probably the simplest solution, although I was hoping to avoid touching the "official" files.

Or change the dcc32.cfg path in Delphi/bin to also first point at the enhanced RTL directory, just like the IDE.

I suspect the JVCL installer does not use the IDE path, but use the default dcc32.cfg file.

I tried that already, it doesn't work.  I've looked at the JVCL installer source code and discovered it builds a dcc32.cfg file on the fly and puts the standard Delphi directories first in the search path. 
At least they provide the source code for the installer, I think I'll try changing it to insert my Enhanced RTL directory at the start.

Thanks for replying Arnaud!

Offline

#22 2012-10-05 08:27:37

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

dougwoodrow wrote:

At least they provide the source code for the installer, I think I'll try changing it to insert my Enhanced RTL directory at the start.

That didn't work either.  After much messing around I eventually thought of using ProcMon to find out why the Jedi JVCL packages were being built with the original grids.dcu - the reason is simple: they're directly accessing the original **packages**: vcl.dcp, rtl.dcp, vcldb.dcp and dbrtl.dcp!

So I guess I just need to rebuild those packages in my own lib directory.  Does anyone here know how to do that?

Offline

#23 2012-10-05 08:47:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I never did that, but I guess you can open the package sources - .bpk I guess.

Offline

#24 2012-10-05 09:51:39

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

I never did that, but I guess you can open the package sources - .bpk I guess.

I think they'd be .dpk for the .pas source files, but I don't have any vcl.dpk or vcl.bpk in my Delphi installation.  Do you?

Offline

#25 2012-10-05 10:43:36

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

OK, I've found a useful post by Dave Nottage explaining how to get Delphi to re-create the packages; I reckon I only need to create vcl.dcp and rtl.dcp as the SynopseRTL doesn't make any DB changes.

So I've been able to create vcl.dpk and rtl.dpk (which I had to edit manually because Delphi incorrectly put %sys32% as the path to the Synopse-modified units:

contains
  ZLib,
  ZLibConst,
  SysUtils in 'C:\WINDOWS\system32\SysUtils.pas',
  Windows,
  Types,
  SysConst,
  Classes in 'C:\WINDOWS\system32\Classes.pas',

)

But I've hit a snag: rtl.dpk contains a reference to "VarHlpr", and that doesn't exist at all in my Delphi installation.  Any ideas?

Offline

#26 2012-10-05 10:55:07

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I've found it on Koders.com, which also has StrHlpr.pas (also referenced in rtl.dpk) - they appear to be part of the OpenCLX project, I wonder if they are actually required for Win32 applications?

Offline

#27 2012-10-05 12:50:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I suspect they are required for Borland C++ compiler only.
That's why they are not part of the Delphi source tree - they should come only with BC++ sources.

If you need the packages (which is to be shared with BC++), those helpers are mandatory.
But I suppose that for pure Delphi applications, they are not required.

Warning about those .pas files: they break the Delphi license, and should not be published.
(this is why we use patches of existing source for our enhanced RTL)

Offline

#28 2012-10-05 14:05:32

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Warning about those .pas files: they break the Delphi license, and should not be published.

I know that for the main RTL source, but that's not true of those 2 missing units:

{ *************************************************************************** }
{                                                                             }
{ Delphi/C++Builder Runtime Library                                           }
{ Helpers for C++ Variant binding.                                            }
{                                                                             }
{ Copyright (c) 2002 Borland Software Corporation                             }
{                                                                             }
{ This file may be distributed and/or modified under the terms of the GNU     }
{ General Public License (GPL) version 2 as published by the Free Software    }
{ Foundation and appearing at http://www.borland.com/kylix/gpl.html.          }
{                                                                             }
{ *************************************************************************** }

Offline

#29 2012-10-05 15:48:06

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

New problem: I placed the resulting rtl70.bpl file in the system32 directory as recommended by Dave Nottage, but this causes the Delphi IDE to throw the following error:

---------------------------
delphi32.exe - Entry Point Not Found
---------------------------
The procedure entry point @Sysutils@DecodeTime$qqrx16System@TDateTimerust2t2t2 could not be located in the dynamic link library rtl70.bpl.

Questions:
1) Does that mean I've built the .DCUs wrongly, or just the .BPL?
2) Will it matter if I keep the original .bpl files in system32?

Offline

#30 2012-10-06 12:44:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Yes, I suspect you need to override ALL reference to the old RTL files, including the .bpl in system32.

But you will need to recompile every .bpl in your computer, so it could not be feasible if you miss some components source code...

My advice is to use the default RTL files for IDE packages and third-party components, then use the enhanced versions only at compile time of your applications.
I usually switch from the default RTL to the enhanced RTL just by changing the project options.
IMHO the enhanced RTL should not be used always, but in some cases where you really need its features.
For instance, it is not mandatory with mORMot, which has already its own optimized version of its most used rountines (after profiling) - enhanced RTL is just a way of increasing the speed of some %.

Offline

#31 2012-10-08 08:24:38

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

But you will need to recompile every .bpl in your computer, so it could not be feasible if you miss some components source code...

Yep: in order to rebuild the JVCL components with SynopseRTL I needed to first rebuild the JCL libraries, and that seems to mean rebuilding Delphi's designide too, and the source for that does not appear to be available sad

My advice is to use the default RTL files for IDE packages and third-party components, then use the enhanced versions only at compile time of your applications.

Do you think that is actually possible with the JVCL components?  Maybe I'm being stupid, but I get the problem I reported in my first post.

I'm beginning to think that it would be best to avoid any changes to the interfaces in this SynopseRTL.

Offline

#32 2012-10-08 08:30:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Yes, not changing the interface may work, but you will loose some enhancements...

Offline

#33 2012-10-08 12:59:40

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

The procedure entry point @Sysutils@DecodeTime$qqrx16System@TDateTimerust2t2t2 could not be located in the dynamic link library rtl70.bpl.

I see now this is because you've changed the declaration of the DecodeTime function from

procedure DecodeTime(const DateTime: TDateTime; ... 

to

procedure DecodeTime(DateTime: TDateTime; ... 

I thought using "const" was faster; could you please explain why you removed it?  (I guess it might be required for your asm code?).

Offline

#34 2012-10-08 14:23:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

From the asm point of view, const or not const is exactly the same for a TDateTime kind of parameter.

But this is not the only changed signature.

Offline

#35 2012-10-08 16:28:40

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

From the asm point of view, const or not const is exactly the same for a TDateTime kind of parameter.

OK, so why remove it?  Doesn't the lack of it result in extra overheads?   I like to understand things smile

Offline

#36 2012-10-09 07:23:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

No it could be defined as const, since the corresponding value is not modified within the asm code, just read into ST(0).

Offline

#37 2013-09-27 00:19:34

louis_riviera
Member
Registered: 2013-09-23
Posts: 61

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Please update for newer delphi aswell as ofcourse 64 bit is here for quite some time.. smile

Offline

#38 2013-09-27 05:32:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Purpose of this Enhanced RTL is only worth it for pre-Unicode version of Delphi.
Newer versions of the RTL are too big (due e.g. to crossplatform and NextGen refactoring), so it is not worth merging the modifications.

It won't make any profit for the 64 platform either.

In mORMot, we by-passed most of the RTL by using our own optimized versions in SynCommons.pas.
So we can reach pretty good performance and multi-thread scaling abilities.

Offline

#39 2014-02-20 10:00:11

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

Currently, this bat file looks like this:

del *.dcu /s
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -$D+ System.pas 
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -NLVCL -$D+ System.pas 
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -DLVCL -N..\ictus3\LVCL -$D+ System.pas 
pause

[...]

I provided the syscom.bat file only to show the right command line switchs to be used (-O+ -Q -M -Y -Z -$D+). Because they are not well documented.

Hi Arnaud, could you please explain what these command line options do exactly?  "-Y" isn't even shown as an option for the dcc32 that comes with Delphi 7, and "-O" is shown as being for "Object directories".
They certainly aren't well documented smile.

Also on the same subject, do you (or anyone else here) know what compiler options are needed to rebuild the .DCUs exactly as provided by Borland?

Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation

Syntax: dcc32 [options] filename [options]

  -A<unit>=<alias> = Set unit alias  -LU<package> = Use package
  -B = Build all units               -M = Make modified units
  -CC = Console target               -N<path> = DCU output directory
  -CG = GUI target                   -O<paths> = Object directories
  -D<syms> = Define conditionals     -P = look for 8.3 file names also
  -E<path> = EXE output directory    -Q = Quiet compile
  -F<offset> = Find error            -R<paths> = Resource directories
  -GD = Detailed map file            -U<paths> = Unit directories
  -GP = Map file with publics        -V = Debug information in EXE
  -GS = Map file with segments       -VR = Generate remote debug (RSM)
  -H = Output hint messages          -W = Output warning messages
  -I<paths> = Include directories    -Z = Output 'never build' DCPs
  -J = Generate .obj file            -$<dir> = Compiler directive
  -JP = Generate C++ .obj file       --help = Show this help screen
  -K<addr> = Set image base addr     --version = Show name and version
Compiler switches: -$<letter><state> (defaults are shown below)
  A8  Aligned record fields           P+  Open string params
  B-  Full boolean Evaluation         Q-  Integer overflow checking
  C+  Evaluate assertions at runtime  R-  Range checking
  D+  Debug information               T-  Typed @ operator
  G+  Use imported data references    U-  Pentium(tm)-safe divide
  H+  Use long strings by default     V+  Strict var-strings
  I+  I/O checking                    W-  Generate stack frames
  J-  Writeable structured consts     X+  Extended syntax
  L+  Local debug symbols             Y+  Symbol reference info
  M-  Runtime type info               Z1  Minimum size of enum types
  O+  Optimization

Offline

#40 2014-02-20 10:30:27

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

dougwoodrow wrote:

Also on the same subject, do you (or anyone else here) know what compiler options are needed to rebuild the .DCUs exactly as provided by Borland?

There is a makefile provided by Borland for the RTL .DCUs, but not for the VCL or anything else, and Borland seems to use different options for individual units.

For their system.dcu they use "-q -m -y -z" like you, but not "-O+", and for sysutils they use "-q -z"

DCC = dcc32 -q

[...]

$(LIB)\system.dcu: sys\system.pas sys\sysinit.pas sys\getmem.inc
 $(DCC) sys\system -m -y -z $(RTLDEBUG) -n$(LIB)

$(LIB)\sysutils.dcu: sys\sysutils.pas  $(LIB)\system.dcu $(LIB)\windows.dcu
 $(DCC) sys\sysutils -z $(RTLDEBUG) -u$(LIB) -r$(LIB) -n$(LIB)

Offline

#41 2014-02-20 13:40:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

AFAIR  "-O+" is to enable optimization.
Worth it. smile

Offline

#42 2014-02-20 17:27:31

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

AFAIR  "-O+" is to enable optimization.

But presumably not the same as the -$O+ switch, which is enabled anyway by default?

I found a utility called DCCShell which indicates the compiler options -O3, -O4, -O5 and -O6 are for optimisations targeting particular CPUs (i386 to Pentium Pro), so I guess -O+ could be the same as -O6, or possibly for later CPUs?

Offline

#43 2014-05-15 10:35:54

dougwoodrow
Member
From: UK
Registered: 2012-10-04
Posts: 32

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

There is a problem with the TJvDBGrid component from the Jedi project caused by the following bit of code in grids.pas:

procedure TCustomGrid.Paint;
[...]

      if DefaultDrawing and not ThemeServices.ThemesEnabled  then begin
        // AB: don't draw black lines for Fixed cells: use XP theme
        DrawLines(goFixedHorzLine in Options, goFixedVertLine in Options,
        0, 0, [0, 0, Horz.FixedBoundary, Vert.FixedBoundary], clBlack, FixedColor);
        DrawLines(goFixedHorzLine in Options, goFixedVertLine in Options,
        LeftCol, 0, [Horz.FixedBoundary, 0, Horz.GridBoundary,
        Vert.FixedBoundary], clBlack, FixedColor);
        DrawLines(goFixedHorzLine in Options, goFixedVertLine in Options,
        0, TopRow, [0, Vert.FixedBoundary, Horz.FixedBoundary,
        Vert.GridBoundary], clBlack, FixedColor);
      end;

When the application is running with the Windows Classic theme, the fixed cell lines are not drawn.  In fact nothing is drawn there, the area is not even cleared.  This results in whatever was previously on the screen appearing where those lines should be.

The reason is that with a TJvDbGrid component, the inherited DefaultDrawing property is always FALSE, regardless of the setting of JvDbGrid.DefaultDrawing.

So a simple fix is to change the if statement like so:

      if not ThemeServices.ThemesEnabled  then begin
        // AB: don't draw black lines for Fixed cells: use XP theme
        [...]

I don't know why the Jedi guys have overridden the DefaultDrawing property, but the original Grids.pas code always drew the black lines, regardless of the DefaultDrawing setting, so it seems to me this change is correct.

(And in case anyone is wondering: the Windows Classic theme is the default theme used in terminal server sessions).

Last edited by dougwoodrow (2014-05-15 10:53:43)

Offline

#44 2014-05-15 15:54:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Thanks for the feedback!

Offline

#45 2015-09-02 11:05:45

agerit_ps
Member
Registered: 2015-09-02
Posts: 1

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

Hello,

i have a problem with compiling our project when i using ERTL for Delphi 7.
FastMM4 and ZEOS component reporting missing o corrupted @FSafeDive

any solution?

Thanks Petr

Offline

#46 2015-09-02 13:51:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I did never see this issue yet.

Are you sure you deleted all the project .dcu?
A "build project" is better.

Offline

#47 2017-03-03 09:11:15

TheOne320
Member
Registered: 2017-03-03
Posts: 1

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

When trying to install the RTL I tried using the 08/2002 version with the original cd and also the 2004 version with my 7.1 installation. Both options give me CRC errors. I am using English Borland Delphi 7 Enterprise. Would should I do?

D421wJv.png

Offline

#48 2017-03-03 09:46:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,751
Website

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

I sent to you a link to download the source code as .zip, not as patches.

But I can't make this link public, due to copyright restrictions of the original Borland code.

Offline

#49 2017-08-15 02:12:23

zuoluoq
Member
Registered: 2017-08-15
Posts: 7

Re: Enhanced System Run Time for Delphi 7 and Delphi 2007

ab wrote:

I sent to you a link to download the source code as .zip, not as patches.

But I can't make this link public, due to copyright restrictions of the original Borland code.

Dear ab,
please send the source code zip file to me also because I get the the error as #47 said
with d7_up1,which has the System.pas file month is 04/2004.
and I have run the http://synopse.info/files/SynopseRTL042004.exe in winXP sp3 Chinese PRC Edition.
But I think it is none business with Chinese Or English language.

Last edited by zuoluoq (2017-08-15 05:18:22)

Offline

Board footer

Powered by FluxBB