Re: [fpc-pascal] inlining functions

2019-01-12 Thread denisgolovan
  12.01.2019, 19:44, "Benito van der Zander" :Hi,  something that appears  to help is to put units in the interface uses rather than the implementation uses.When the unit mentioned in the interface uses, uses the first unit in its implementation uses, it can inline the functions from the first

Re: [fpc-pascal] inlining functions

2019-01-12 Thread Benito van der Zander
Hi,  something that appears  to help is to put units in the interface uses rather than the implementation uses. When the unit mentioned in the interface uses, uses the first unit in its implementation uses, it can inline the functions from the first unit. Although I would have expected it

Re: [fpc-pascal] inlining functions

2019-01-12 Thread denisgolovan
  12.01.2019, 16:03, "Sven Barth via fpc-pascal" :With WPO you need to compile at least twice as well as the first pass only collects information and acts on it in the second pass. Is it possible to make Lazarus do that automatically?According to Jonas it's a bit too unpractical. -- Regards,Denis

Re: [fpc-pascal] inlining functions

2019-01-12 Thread denisgolovan
12.01.2019, 15:32, "Jonas Maebe" : > It's not yet integrated in the compiler, so you have to do it manually > right now: > a) compile everything with -al (including the RTL etc; add OPT="-a" to > the make command) > b) go in all the unit directories, and assemble the files to bitcode > using

Re: [fpc-pascal] inlining functions

2019-01-12 Thread Sven Barth via fpc-pascal
Am Sa., 12. Jan. 2019, 13:05 hat denisgolovan geschrieben: > > However, what you actually can do, is manually recompile all units of > your program > > multiple times. While this won't help with inline functions called > > before they are parsed in those same units, it will allow inlining of > >

Re: [fpc-pascal] inlining functions

2019-01-12 Thread Jonas Maebe
On 12/01/19 13:05, denisgolovan wrote: 12.01.2019, 14:53, "Jonas Maebe" : Not at this time (unless you use the LLVM backend). Could you give some hints on how to enable WPO/LTO under LLVM backend? http://wiki.freepascal.org/LLVM does not seem to mention anything on that. It's not yet

Re: [fpc-pascal] inlining functions

2019-01-12 Thread denisgolovan
12.01.2019, 14:53, "Jonas Maebe" : > Not at this time (unless you use the LLVM backend). Could you give some hints on how to enable WPO/LTO under LLVM backend? http://wiki.freepascal.org/LLVM does not seem to mention anything on that. > However, what you actually can do, is manually recompile

Re: [fpc-pascal] inlining functions

2019-01-12 Thread Jonas Maebe
On 12/01/19 12:47, denisgolovan wrote: 07.01.2019, 00:45, "Jonas Maebe" : Not besides breaking your dependency cycles. Sorry, but for necro-posting, but shouldn't WPO is supposed to help to inline functions as well? Not at this time (unless you use the LLVM backend). However, what you

Re: [fpc-pascal] inlining functions

2019-01-12 Thread denisgolovan
07.01.2019, 00:45, "Jonas Maebe" : > Not besides breaking your dependency cycles. Sorry, but for necro-posting, but shouldn't WPO is supposed to help to inline functions as well? -- Regards, Denis Golovan ___ fpc-pascal maillist -

Re: [fpc-pascal] inlining functions

2019-01-06 Thread Jonas Maebe
On 03/01/19 00:10, Benito van der Zander wrote: The one-pass thing is probably the reason it now complains about all inline functions in dependency cycles, unit A uses unit B that uses unit A. Then unit A can't inline something unit B. Any way around that? Not besides breaking your dependency

Re: [fpc-pascal] inlining functions

2019-01-02 Thread Benito van der Zander
Hi, procedure TStrBuilder.append(const s: RawByteString); begin append(pchar(pointer(s)), length(s)); //inlinetest.pas(24,3) Note: Call to subroutine "procedure TStrBuilder.append(const p:PChar;const l:Int64);" marked as inline is not inlined end; this seems to help procedure

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Jonas Maebe
On 2019-01-02 00:19, Benito van der Zander wrote: procedure TStrBuilder.append(const s: RawByteString); begin append(pchar(pointer(s)), length(s)); //inlinetest.pas(24,3) Note: Call to subroutine "procedure TStrBuilder.append(const p:PChar;const l:Int64);" marked as inline is not inlined

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Benito van der Zander
Hi Jonas, That is reasonable. Perhaps the hint should mention that? But why is this still not inlined:: type TStrBuilder = object   procedure append(const p: pchar; const l: SizeInt); inline;   procedure append(const s: RawByteString); end; implementation procedure TStrBuilder.append(const

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Jonas Maebe
On 01/01/19 22:38, Benito van der Zander wrote: and why is it not inlining the count and append call of this string builder? It is not using any implementation only function Routines can only be inlined if they are called after their implementation has been parsed. FPC compiles everything in

Re: [fpc-pascal] inlining functions

2019-01-01 Thread Benito van der Zander
Hi, and why is it not inlining the count and append call of this string builder? It is not using any implementation only function unit inlinetest; {$mode objfpc}{$H+} interface uses   Classes, SysUtils,math; type TStrBuilder = object protected   next, bufferend: pchar; //next empty pchar

Re: [fpc-pascal] inlining functions depending on implementation only functions

2018-12-29 Thread Sven Barth via fpc-pascal
Am Sa., 29. Dez. 2018, 15:23 hat Benito van der Zander geschrieben: > Hi, > > after updating from fpc 3.1 to fpc 3.3, I am getting a lot of "function > was not inlined" warnings, e.g. when an inline function depends on a > function not declared in the interface part like: > > unit inlinetest; >

Re: [fpc-pascal] inlining functions depending on implementation only functions

2018-12-29 Thread wkitty42
On 12/29/18 9:16 AM, Benito van der Zander wrote: Fpc 3.1 did not show any warning in this case (although now that I investigate it, fpc 3.1 also did not seem to inline it despite not showing the warning) i think, but am not totally sure, that the addition of the warning is a recently added

[fpc-pascal] inlining functions depending on implementation only functions

2018-12-29 Thread Benito van der Zander
Hi, after updating from fpc 3.1 to fpc 3.3, I am getting a lot of "function was not inlined" warnings, e.g. when an inline function depends on a function not declared in the interface part like: unit inlinetest; {$mode objfpc}{$H+} interface uses   Classes, SysUtils; function

Re: [fpc-pascal] inlining functions

2006-10-19 Thread Michael Van Canneyt
On Thu, 19 Oct 2006, Marc Santhoff wrote: Hi, when using inline on a procedure or function, does it completely avoid the call by copying anything inside the begin ... end block to the right place? Yes, that's the idea. Michael. ___ fpc-pascal

Re: [fpc-pascal] inlining functions

2006-10-19 Thread Marc Santhoff
Am Donnerstag, den 19.10.2006, 09:05 +0200 schrieb Michael Van Canneyt: On Thu, 19 Oct 2006, Marc Santhoff wrote: Hi, when using inline on a procedure or function, does it completely avoid the call by copying anything inside the begin ... end block to the right place? Yes,

Re[2]: [fpc-pascal] inlining functions

2006-10-19 Thread ϸ�� ����������� � mail.ru
Hi, when using inline on a procedure or function, does it completely avoid the call by copying anything inside the begin ... end block to the right place? Yes, that's the idea. INLINE is a suggestion, not obligation: sometimes they are compiled with CALL. It looks especially not great

[fpc-pascal] inlining functions

2006-10-18 Thread Marc Santhoff
Hi, when using inline on a procedure or function, does it completely avoid the call by copying anything inside the begin ... end block to the right place? Example: function anythingFunc(v: integer):real; inline; begin ... some calculations ... end; function TMyObject.callAnything(v: