View Issue Details

IDProjectCategoryView StatusLast Update
0035783FPCRTLpublic2019-07-10 19:13
ReporterAkira1364Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSWindowsOS Version10
Product Version3.3.1Product BuildTrunk 
Target VersionFixed in Version 
Summary0035783: [PATCH] Marks all GetCurrent/MoveNext/GetEnumerator functions in classesh.inc as inline. Speed boost + it's what Delphi does.
DescriptionI had been noticing some discrepancies in enumerator-loop performance between Delphi Rio and FPC recently, and after some investigation boiled it down to the fact that Delphi currently (and has since probably Delphi 2009, I imagine) has all enumerator-related function in the Classes interface marked as inline.

I've attached a patch (that touches only classesh.inc as that is all that's needed) which adds those modifiers.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • 0001-enumerator_inlining.patch (5,039 bytes)
    From 682a3b4229373ed192755cebfb87a93236948b59 Mon Sep 17 00:00:00 2001
    From: BenGrasset <operator97@gmail.com>
    Date: Sat, 29 Jun 2019 19:44:19 -0400
    Subject: [PATCH] enumerator_inlining
    
    ---
     rtl/objpas/classes/classesh.inc | 36 ++++++++++++++++-----------------
     1 file changed, 18 insertions(+), 18 deletions(-)
    
    diff --git rtl/objpas/classes/classesh.inc rtl/objpas/classes/classesh.inc
    index 871e605e20..98e491bf4b 100644
    --- rtl/objpas/classes/classesh.inc
    +++ rtl/objpas/classes/classesh.inc
    @@ -207,8 +207,8 @@ Type
         FPosition: Integer;
       public
         constructor Create(AList: TFPList);
    -    function GetCurrent: Pointer;
    -    function MoveNext: Boolean;
    +    function GetCurrent: Pointer; inline;
    +    function MoveNext: Boolean; inline;
         property Current: Pointer read GetCurrent;
       end;
     
    @@ -245,7 +245,7 @@ Type
         function Expand: TFPList; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function Extract(Item: Pointer): Pointer;
         function First: Pointer;
    -    function GetEnumerator: TFPListEnumerator;
    +    function GetEnumerator: TFPListEnumerator; inline;
         function IndexOf(Item: Pointer): Integer;
         function IndexOfItem(Item: Pointer; Direction: TDirection): Integer;
         procedure Insert(Index: Integer; Item: Pointer); {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    @@ -290,8 +290,8 @@ Type
         FPosition: Integer;
       public
         constructor Create(AList: TList);
    -    function GetCurrent: Pointer;
    -    function MoveNext: Boolean;
    +    function GetCurrent: Pointer; inline;
    +    function MoveNext: Boolean; inline;
         property Current: Pointer read GetCurrent;
       end;
     
    @@ -332,7 +332,7 @@ Type
         function Expand: TList;
         function Extract(item: Pointer): Pointer;
         function First: Pointer;
    -    function GetEnumerator: TListEnumerator;
    +    function GetEnumerator: TListEnumerator; inline;
         function IndexOf(Item: Pointer): Integer;
         procedure Insert(Index: Integer; Item: Pointer);
         function Last: Pointer;
    @@ -511,8 +511,8 @@ type
         FPosition: Integer;
       public
         constructor Create(ACollection: TCollection);
    -    function GetCurrent: TCollectionItem;
    -    function MoveNext: Boolean;
    +    function GetCurrent: TCollectionItem; inline;
    +    function MoveNext: Boolean; inline;
         property Current: TCollectionItem read GetCurrent;
       end;
     
    @@ -556,7 +556,7 @@ type
         procedure Clear;
         procedure EndUpdate; virtual;
         procedure Delete(Index: Integer);
    -    function GetEnumerator: TCollectionEnumerator;
    +    function GetEnumerator: TCollectionEnumerator; inline;
         function GetNamePath: string; override;
         function Insert(Index: Integer): TCollectionItem;
         function FindItemID(ID: Integer): TCollectionItem;
    @@ -596,8 +596,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AStrings: TStrings);
    -    function GetCurrent: String;
    -    function MoveNext: Boolean;
    +    function GetCurrent: String; inline;
    +    function MoveNext: Boolean; inline;
         property Current: String read GetCurrent;
       end;
     
    @@ -698,7 +698,7 @@ type
         function Equals(TheStrings: TStrings): Boolean; overload;
         procedure Exchange(Index1, Index2: Integer); virtual;
         function  ExtractName(Const S:String):String;
    -    function GetEnumerator: TStringsEnumerator;
    +    function GetEnumerator: TStringsEnumerator; inline;
         procedure GetNameValue(Index : Integer; Out AName,AValue : String);
         function GetText: PChar; virtual;
         function IndexOf(const S: string): Integer; virtual;
    @@ -1976,8 +1976,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AComponent: TComponent);
    -    function GetCurrent: TComponent;
    -    function MoveNext: Boolean;
    +    function GetCurrent: TComponent; inline;
    +    function MoveNext: Boolean; inline;
         property Current: TComponent read GetCurrent;
       end;
     
    @@ -2065,7 +2065,7 @@ type
         procedure FreeNotification(AComponent: TComponent);
         procedure RemoveFreeNotification(AComponent: TComponent);
         procedure FreeOnRelease;
    -    function GetEnumerator: TComponentEnumerator;
    +    function GetEnumerator: TComponentEnumerator; inline;
         function GetNamePath: string; override;
         function GetParentComponent: TComponent; dynamic;
         function HasParent: Boolean; dynamic;
    @@ -2181,8 +2181,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AList: TInterfaceList);
    -    function GetCurrent: IUnknown;
    -    function MoveNext: Boolean;
    +    function GetCurrent: IUnknown; inline;
    +    function MoveNext: Boolean; inline;
         property Current: IUnknown read GetCurrent;
       end;
     
    @@ -2204,7 +2204,7 @@ type
         procedure Delete(index : Integer);
         procedure Exchange(index1,index2 : Integer);
         function First : IUnknown;
    -    function GetEnumerator: TInterfaceListEnumerator;
    +    function GetEnumerator: TInterfaceListEnumerator; inline;
         function IndexOf(item : IUnknown) : Integer;
         function Add(item : IUnknown) : Integer;
         procedure Insert(i : Integer;item : IUnknown);
    -- 
    2.22.0.windows.1
    
    
  • 0001-enumerator_inlining_with_classesinline.patch (5,552 bytes)
    ---
     rtl/objpas/classes/classesh.inc | 36 ++++++++++++++++-----------------
     1 file changed, 18 insertions(+), 18 deletions(-)
    
    --- rtl/objpas/classes/classesh.inc
    +++ rtl/objpas/classes/classesh.inc
    @@ -207,8 +207,8 @@ Type
         FPosition: Integer;
       public
         constructor Create(AList: TFPList);
    -    function GetCurrent: Pointer;
    -    function MoveNext: Boolean;
    +    function GetCurrent: Pointer; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: Pointer read GetCurrent;
       end;
     
    @@ -245,7 +245,7 @@ Type
         function Expand: TFPList; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function Extract(Item: Pointer): Pointer;
         function First: Pointer;
    -    function GetEnumerator: TFPListEnumerator;
    +    function GetEnumerator: TFPListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function IndexOf(Item: Pointer): Integer;
         function IndexOfItem(Item: Pointer; Direction: TDirection): Integer;
         procedure Insert(Index: Integer; Item: Pointer); {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    @@ -290,8 +290,8 @@ Type
         FPosition: Integer;
       public
         constructor Create(AList: TList);
    -    function GetCurrent: Pointer;
    -    function MoveNext: Boolean;
    +    function GetCurrent: Pointer; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: Pointer read GetCurrent;
       end;
     
    @@ -332,7 +332,7 @@ Type
         function Expand: TList;
         function Extract(item: Pointer): Pointer;
         function First: Pointer;
    -    function GetEnumerator: TListEnumerator;
    +    function GetEnumerator: TListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function IndexOf(Item: Pointer): Integer;
         procedure Insert(Index: Integer; Item: Pointer);
         function Last: Pointer;
    @@ -511,8 +511,8 @@ type
         FPosition: Integer;
       public
         constructor Create(ACollection: TCollection);
    -    function GetCurrent: TCollectionItem;
    -    function MoveNext: Boolean;
    +    function GetCurrent: TCollectionItem; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: TCollectionItem read GetCurrent;
       end;
     
    @@ -556,7 +556,7 @@ type
         procedure Clear;
         procedure EndUpdate; virtual;
         procedure Delete(Index: Integer);
    -    function GetEnumerator: TCollectionEnumerator;
    +    function GetEnumerator: TCollectionEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function GetNamePath: string; override;
         function Insert(Index: Integer): TCollectionItem;
         function FindItemID(ID: Integer): TCollectionItem;
    @@ -596,8 +596,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AStrings: TStrings);
    -    function GetCurrent: String;
    -    function MoveNext: Boolean;
    +    function GetCurrent: String; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: String read GetCurrent;
       end;
     
    @@ -698,7 +698,7 @@ type
         function Equals(TheStrings: TStrings): Boolean; overload;
         procedure Exchange(Index1, Index2: Integer); virtual;
         function  ExtractName(Const S:String):String;
    -    function GetEnumerator: TStringsEnumerator;
    +    function GetEnumerator: TStringsEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         procedure GetNameValue(Index : Integer; Out AName,AValue : String);
         function GetText: PChar; virtual;
         function IndexOf(const S: string): Integer; virtual;
    @@ -1976,8 +1976,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AComponent: TComponent);
    -    function GetCurrent: TComponent;
    -    function MoveNext: Boolean;
    +    function GetCurrent: TComponent; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: TComponent read GetCurrent;
       end;
     
    @@ -2065,7 +2065,7 @@ type
         procedure FreeNotification(AComponent: TComponent);
         procedure RemoveFreeNotification(AComponent: TComponent);
         procedure FreeOnRelease;
    -    function GetEnumerator: TComponentEnumerator;
    +    function GetEnumerator: TComponentEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function GetNamePath: string; override;
         function GetParentComponent: TComponent; dynamic;
         function HasParent: Boolean; dynamic;
    @@ -2181,8 +2181,8 @@ type
         FPosition: Integer;
       public
         constructor Create(AList: TInterfaceList);
    -    function GetCurrent: IUnknown;
    -    function MoveNext: Boolean;
    +    function GetCurrent: IUnknown; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
    +    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         property Current: IUnknown read GetCurrent;
       end;
     
    @@ -2204,7 +2204,7 @@ type
         procedure Delete(index : Integer);
         procedure Exchange(index1,index2 : Integer);
         function First : IUnknown;
    -    function GetEnumerator: TInterfaceListEnumerator;
    +    function GetEnumerator: TInterfaceListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
         function IndexOf(item : IUnknown) : Integer;
         function Add(item : IUnknown) : Integer;
         procedure Insert(i : Integer;item : IUnknown);
    -- 
    
    

Activities

Akira1364

2019-06-30 02:25

reporter  

0001-enumerator_inlining.patch (5,039 bytes)
From 682a3b4229373ed192755cebfb87a93236948b59 Mon Sep 17 00:00:00 2001
From: BenGrasset <operator97@gmail.com>
Date: Sat, 29 Jun 2019 19:44:19 -0400
Subject: [PATCH] enumerator_inlining

---
 rtl/objpas/classes/classesh.inc | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git rtl/objpas/classes/classesh.inc rtl/objpas/classes/classesh.inc
index 871e605e20..98e491bf4b 100644
--- rtl/objpas/classes/classesh.inc
+++ rtl/objpas/classes/classesh.inc
@@ -207,8 +207,8 @@ Type
     FPosition: Integer;
   public
     constructor Create(AList: TFPList);
-    function GetCurrent: Pointer;
-    function MoveNext: Boolean;
+    function GetCurrent: Pointer; inline;
+    function MoveNext: Boolean; inline;
     property Current: Pointer read GetCurrent;
   end;
 
@@ -245,7 +245,7 @@ Type
     function Expand: TFPList; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function Extract(Item: Pointer): Pointer;
     function First: Pointer;
-    function GetEnumerator: TFPListEnumerator;
+    function GetEnumerator: TFPListEnumerator; inline;
     function IndexOf(Item: Pointer): Integer;
     function IndexOfItem(Item: Pointer; Direction: TDirection): Integer;
     procedure Insert(Index: Integer; Item: Pointer); {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
@@ -290,8 +290,8 @@ Type
     FPosition: Integer;
   public
     constructor Create(AList: TList);
-    function GetCurrent: Pointer;
-    function MoveNext: Boolean;
+    function GetCurrent: Pointer; inline;
+    function MoveNext: Boolean; inline;
     property Current: Pointer read GetCurrent;
   end;
 
@@ -332,7 +332,7 @@ Type
     function Expand: TList;
     function Extract(item: Pointer): Pointer;
     function First: Pointer;
-    function GetEnumerator: TListEnumerator;
+    function GetEnumerator: TListEnumerator; inline;
     function IndexOf(Item: Pointer): Integer;
     procedure Insert(Index: Integer; Item: Pointer);
     function Last: Pointer;
@@ -511,8 +511,8 @@ type
     FPosition: Integer;
   public
     constructor Create(ACollection: TCollection);
-    function GetCurrent: TCollectionItem;
-    function MoveNext: Boolean;
+    function GetCurrent: TCollectionItem; inline;
+    function MoveNext: Boolean; inline;
     property Current: TCollectionItem read GetCurrent;
   end;
 
@@ -556,7 +556,7 @@ type
     procedure Clear;
     procedure EndUpdate; virtual;
     procedure Delete(Index: Integer);
-    function GetEnumerator: TCollectionEnumerator;
+    function GetEnumerator: TCollectionEnumerator; inline;
     function GetNamePath: string; override;
     function Insert(Index: Integer): TCollectionItem;
     function FindItemID(ID: Integer): TCollectionItem;
@@ -596,8 +596,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AStrings: TStrings);
-    function GetCurrent: String;
-    function MoveNext: Boolean;
+    function GetCurrent: String; inline;
+    function MoveNext: Boolean; inline;
     property Current: String read GetCurrent;
   end;
 
@@ -698,7 +698,7 @@ type
     function Equals(TheStrings: TStrings): Boolean; overload;
     procedure Exchange(Index1, Index2: Integer); virtual;
     function  ExtractName(Const S:String):String;
-    function GetEnumerator: TStringsEnumerator;
+    function GetEnumerator: TStringsEnumerator; inline;
     procedure GetNameValue(Index : Integer; Out AName,AValue : String);
     function GetText: PChar; virtual;
     function IndexOf(const S: string): Integer; virtual;
@@ -1976,8 +1976,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AComponent: TComponent);
-    function GetCurrent: TComponent;
-    function MoveNext: Boolean;
+    function GetCurrent: TComponent; inline;
+    function MoveNext: Boolean; inline;
     property Current: TComponent read GetCurrent;
   end;
 
@@ -2065,7 +2065,7 @@ type
     procedure FreeNotification(AComponent: TComponent);
     procedure RemoveFreeNotification(AComponent: TComponent);
     procedure FreeOnRelease;
-    function GetEnumerator: TComponentEnumerator;
+    function GetEnumerator: TComponentEnumerator; inline;
     function GetNamePath: string; override;
     function GetParentComponent: TComponent; dynamic;
     function HasParent: Boolean; dynamic;
@@ -2181,8 +2181,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AList: TInterfaceList);
-    function GetCurrent: IUnknown;
-    function MoveNext: Boolean;
+    function GetCurrent: IUnknown; inline;
+    function MoveNext: Boolean; inline;
     property Current: IUnknown read GetCurrent;
   end;
 
@@ -2204,7 +2204,7 @@ type
     procedure Delete(index : Integer);
     procedure Exchange(index1,index2 : Integer);
     function First : IUnknown;
-    function GetEnumerator: TInterfaceListEnumerator;
+    function GetEnumerator: TInterfaceListEnumerator; inline;
     function IndexOf(item : IUnknown) : Integer;
     function Add(item : IUnknown) : Integer;
     procedure Insert(i : Integer;item : IUnknown);
-- 
2.22.0.windows.1

Akira1364

2019-06-30 21:55

reporter   ~0117021

Noticed I should probably use {$ifdef CLASSESINLINE}, as the other inline methods in the file do. Attached a new version of the patch.

Is CLASSESINLINE set to true by default at some point, also? I'd hope so.

0001-enumerator_inlining_with_classesinline.patch (5,552 bytes)
---
 rtl/objpas/classes/classesh.inc | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

--- rtl/objpas/classes/classesh.inc
+++ rtl/objpas/classes/classesh.inc
@@ -207,8 +207,8 @@ Type
     FPosition: Integer;
   public
     constructor Create(AList: TFPList);
-    function GetCurrent: Pointer;
-    function MoveNext: Boolean;
+    function GetCurrent: Pointer; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: Pointer read GetCurrent;
   end;
 
@@ -245,7 +245,7 @@ Type
     function Expand: TFPList; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function Extract(Item: Pointer): Pointer;
     function First: Pointer;
-    function GetEnumerator: TFPListEnumerator;
+    function GetEnumerator: TFPListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function IndexOf(Item: Pointer): Integer;
     function IndexOfItem(Item: Pointer; Direction: TDirection): Integer;
     procedure Insert(Index: Integer; Item: Pointer); {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
@@ -290,8 +290,8 @@ Type
     FPosition: Integer;
   public
     constructor Create(AList: TList);
-    function GetCurrent: Pointer;
-    function MoveNext: Boolean;
+    function GetCurrent: Pointer; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: Pointer read GetCurrent;
   end;
 
@@ -332,7 +332,7 @@ Type
     function Expand: TList;
     function Extract(item: Pointer): Pointer;
     function First: Pointer;
-    function GetEnumerator: TListEnumerator;
+    function GetEnumerator: TListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function IndexOf(Item: Pointer): Integer;
     procedure Insert(Index: Integer; Item: Pointer);
     function Last: Pointer;
@@ -511,8 +511,8 @@ type
     FPosition: Integer;
   public
     constructor Create(ACollection: TCollection);
-    function GetCurrent: TCollectionItem;
-    function MoveNext: Boolean;
+    function GetCurrent: TCollectionItem; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: TCollectionItem read GetCurrent;
   end;
 
@@ -556,7 +556,7 @@ type
     procedure Clear;
     procedure EndUpdate; virtual;
     procedure Delete(Index: Integer);
-    function GetEnumerator: TCollectionEnumerator;
+    function GetEnumerator: TCollectionEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function GetNamePath: string; override;
     function Insert(Index: Integer): TCollectionItem;
     function FindItemID(ID: Integer): TCollectionItem;
@@ -596,8 +596,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AStrings: TStrings);
-    function GetCurrent: String;
-    function MoveNext: Boolean;
+    function GetCurrent: String; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: String read GetCurrent;
   end;
 
@@ -698,7 +698,7 @@ type
     function Equals(TheStrings: TStrings): Boolean; overload;
     procedure Exchange(Index1, Index2: Integer); virtual;
     function  ExtractName(Const S:String):String;
-    function GetEnumerator: TStringsEnumerator;
+    function GetEnumerator: TStringsEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     procedure GetNameValue(Index : Integer; Out AName,AValue : String);
     function GetText: PChar; virtual;
     function IndexOf(const S: string): Integer; virtual;
@@ -1976,8 +1976,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AComponent: TComponent);
-    function GetCurrent: TComponent;
-    function MoveNext: Boolean;
+    function GetCurrent: TComponent; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: TComponent read GetCurrent;
   end;
 
@@ -2065,7 +2065,7 @@ type
     procedure FreeNotification(AComponent: TComponent);
     procedure RemoveFreeNotification(AComponent: TComponent);
     procedure FreeOnRelease;
-    function GetEnumerator: TComponentEnumerator;
+    function GetEnumerator: TComponentEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function GetNamePath: string; override;
     function GetParentComponent: TComponent; dynamic;
     function HasParent: Boolean; dynamic;
@@ -2181,8 +2181,8 @@ type
     FPosition: Integer;
   public
     constructor Create(AList: TInterfaceList);
-    function GetCurrent: IUnknown;
-    function MoveNext: Boolean;
+    function GetCurrent: IUnknown; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
+    function MoveNext: Boolean; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     property Current: IUnknown read GetCurrent;
   end;
 
@@ -2204,7 +2204,7 @@ type
     procedure Delete(index : Integer);
     procedure Exchange(index1,index2 : Integer);
     function First : IUnknown;
-    function GetEnumerator: TInterfaceListEnumerator;
+    function GetEnumerator: TInterfaceListEnumerator; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
     function IndexOf(item : IUnknown) : Integer;
     function Add(item : IUnknown) : Integer;
     procedure Insert(i : Integer;item : IUnknown);
-- 

Sven Barth

2019-07-01 11:05

manager   ~0117023

Now that you mention it, it seems that CLASSESINLINE is never set anywhere in the RTL... :/

Akira1364

2019-07-02 16:28

reporter   ~0117028

Yikes! I guess my questions are, then:

A) What was the original purpose of this define? That is, when would someone have wanted inlining to be completely disabled in "Classes"?

B) Is said purpose still relevant, or should the define be removed to just allow inline methods to be inline methods in all cases?

C) What would be the best place to conditionally set the define to true, if it *is* still needed at all?

rd0x

2019-07-02 19:24

reporter   ~0117029

I guess you need A) if you want to debug something from Classes unit

Akira1364

2019-07-02 21:14

reporter   ~0117030

FPC tends to have explicit defines for debugging-related stuff that are *opt-in*, though. Meaning you would set the define to *disable* inlining, not set it to *enable* it. So I feel like in all likelihood, that wasn't the original intent of this one.

Issue History

Date Modified Username Field Change
2019-06-30 02:25 Akira1364 New Issue
2019-06-30 02:25 Akira1364 File Added: 0001-enumerator_inlining.patch
2019-06-30 21:55 Akira1364 File Added: 0001-enumerator_inlining_with_classesinline.patch
2019-06-30 21:55 Akira1364 Note Added: 0117021
2019-07-01 11:05 Sven Barth Note Added: 0117023
2019-07-02 16:28 Akira1364 Note Added: 0117028
2019-07-02 19:24 rd0x Note Added: 0117029
2019-07-02 21:14 Akira1364 Note Added: 0117030