mORMot and Open Source friends
Check-in [c2c13a48bc]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{6423} try to circumvent Delphi optimizer bug - Delphi does not seem to like inlining + goto/label - FPC has no trouble about, but keep the optimized version in mORMot 2 only
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c2c13a48bc19bb1c561bbe96a58955588d102ff7
User & Date: ab 2022-12-11 10:41:09
Context
2022-12-14
08:42
{6424} fixed HttpGet() outStatus optional value - as reported by #440 check-in: 99d74b360c user: ab tags: trunk
2022-12-11
10:41
{6423} try to circumvent Delphi optimizer bug - Delphi does not seem to like inlining + goto/label - FPC has no trouble about, but keep the optimized version in mORMot 2 only check-in: c2c13a48bc user: ab tags: trunk
2022-12-09
08:11
{6422} fixed RemoteIP on THttpServer - see https://github.com/synopse/mORMot/issues/439 check-in: f84a14afdd user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCommons.pas.

49811
49812
49813
49814
49815
49816
49817
49818
49819
49820

49821
49822
49823
49824
49825
49826
49827
49828
49829
49830
49831
49832
49833
49834
49835
49836
49837
49838
49839
49840
49841
49842
49843
49844
49845
  end else
    FillCharFast(P^,ElemSize,0);
  SetCount(n);
  result := true;
end;

function TDynArray.ElemPtr(index: PtrInt): pointer;
label ok;
var c: PtrUInt;
begin // very efficient code on FPC and modern Delphi

  result := pointer(fValue);
  if result=nil then
    exit;
  result := PPointer(result)^;
  if result=nil then
    exit;
  c := PtrUInt(fCountP);
  if c<>0 then begin
    if PtrUInt(index)<PCardinal(c)^ then
ok:   inc(PByte(result),PtrUInt(index)*ElemSize) else
      result := nil
  end else
    {$ifdef FPC}
    if PtrUInt(index)<=PPtrUInt(PtrUInt(result)-_DALEN)^ then
    {$else}
    if PtrUInt(index)<PPtrUInt(PtrUInt(result)-_DALEN)^ then
    {$endif FPC}
      goto ok else
      result := nil;
end;

procedure TDynArray.ElemCopyAt(index: PtrInt; var Dest);
var p: pointer;
begin
  p := ElemPtr(index);






<

<
>







|

|

|





|







49811
49812
49813
49814
49815
49816
49817

49818

49819
49820
49821
49822
49823
49824
49825
49826
49827
49828
49829
49830
49831
49832
49833
49834
49835
49836
49837
49838
49839
49840
49841
49842
49843
49844
  end else
    FillCharFast(P^,ElemSize,0);
  SetCount(n);
  result := true;
end;

function TDynArray.ElemPtr(index: PtrInt): pointer;

var c: PtrUInt;

begin // no goto/label, because it does not properly inline on modern Delphi
  result := pointer(fValue);
  if result=nil then
    exit;
  result := PPointer(result)^;
  if result=nil then
    exit;
  c := PtrUInt(fCountP);
  if c<>0 then
    if PtrUInt(index)<PCardinal(c)^ then
      inc(PByte(result),PtrUInt(index)*ElemSize) else
      result := nil
  else
    {$ifdef FPC}
    if PtrUInt(index)<=PPtrUInt(PtrUInt(result)-_DALEN)^ then
    {$else}
    if PtrUInt(index)<PPtrUInt(PtrUInt(result)-_DALEN)^ then
    {$endif FPC}
      inc(PByte(result),PtrUInt(index)*ElemSize) else
      result := nil;
end;

procedure TDynArray.ElemCopyAt(index: PtrInt; var Dest);
var p: pointer;
begin
  p := ElemPtr(index);

Changes to SynopseCommit.inc.

1
'1.18.6422'
|
1
'1.18.6423'