Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2023-11

LLVM, interfaces and nested procedure variables

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kieran

Hi,

I'm trying to reproduce a minimal viable demo of a problem compiling code using the LLVM backend that has an interface with a parameter that is a nested procedure variable, but I'm not having any luck. I've noticed the difference between my test programs and the large project where I'm seeing the issue reliably is that when compiling the larger project, the line "Parsing internally generated code" (I think that's error string 3319/"Parsen intern erzeugten") gets output with what looks like interface method shims for an object -- methods prefixed "WRPR_".

I can't get my test programs to do the same even when trying the same compiler arguments and directives, so I've tried to make the objects more complicated -- adding variables to the class, lots of procedures, multiple interfaces, implementations that are actually abstract... nothing's triggered it.

The gist of my test code is something like this:

TNestedProc = procedure is nested;
IInf = interface[...]
    procedure InfMethod(AParam: TNestedProc);
end;

TObj = class(..., IInf)

My question is: what are some triggers for internal code generation?

As to the actual error that I'm trying to put together a useful bug report for, the code that is generated internally (in the shim) gets the error "Error: (4030) Can't assign local procedure/function to procedure variable", it's in the same unit as both a {$modeswitch nestedprocvars} and a bunch of other code that throw around nested procedure variables.

Thanks
Kieran

Reply by email

Jonas Maebe
to Kieran
Kieran wrote 11 lines
I'm trying to reproduce a minimal viable demo of a problem compiling code using the LLVM backend that has an interface with a parameter that is a nested procedure variable, but I'm not having any luck. I've noticed the difference between my test programs and the large project where I'm seeing the issue reliably is that when compiling the larger project, the line "Parsing internally generated code" (I think that's error string 3319/"Parsen intern erzeugten") gets output with what looks like interface method shims for an object -- methods prefixed "WRPR_".  I can't get my test programs to do the same even when trying the same compiler arguments and directives

That should happen whenever you implement an interface method in a class.

I can reproduce the issue with the program in attachment.

Jonas

Reply by email

Kieran
to Jonas Maebe

Thanks Jonas, I was mistakenly invoking my non-LLVM compiler.

On Sat, 25 Nov 2023 at 12:08, Jonas Maebe via fpc-devel <

Show quoted text 24 lines
wrote: On 25/11/2023 12:48, Kieran via fpc-devel wrote: > I'm trying to reproduce a minimal viable demo of a problem compiling > code using the LLVM backend that has an interface with a parameter > that is a nested procedure variable, but I'm not having any luck. I've > noticed the difference between my test programs and the large project > where I'm seeing the issue reliably is that when compiling the larger > project, the line "Parsing internally generated code" (I think that's > error string 3319/"Parsen intern erzeugten") gets output with what looks > like interface method shims for an object -- methods prefixed "WRPR_". > > I can't get my test programs to do the same even when trying the same > compiler arguments and directives That should happen whenever you implement an interface method in a class. I can reproduce the issue with the program in attachment. Jonas_______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email