-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add none-native calling for class methods/properties. #210
base: master
Are you sure you want to change the base?
Add none-native calling for class methods/properties. #210
Conversation
….RegisterMethodName and TPSRuntimeClass.RegisterPropertyNameHelper
please provide an example of use |
User4martin/lazarus@e30b8c8 Using the InnerfuseCall did IIRC for example not work on arm (raspi) when sets are involved. Though I have not tested the new implementation on arm, as I do not have a test env setup (I am waiting for feedback) Again not tested, InnerfuseCall might also need work for fpc trunk on linux 32bit, as fpc changed calling convention. RegisterFunctionName has been available for a long time already. And I had looked at it (in fact I had IFDEF'D code for it) long ago. Given the fact, that at least on fpc, InnerfuseCall would need careful retesting with every fpc release, I had actually always thought the absence of alternative methods for properties was because no one had found the time to do them. That is why in the IDE I run a self-test at each startup (since a user could have build it with any version of fpc, including future). This self-test is carefully designed to detected if it crashed on its last run. Because if fpc changes calling convention, building older IDE code (with older PascalScript) with newer fpc, has the very real potential of crashing. |
Need samples of usage. |
FPC + x64 - InnerfuseCall without asm: https://github.com/pult/pascalscript/blob/fix_20170321_x64call/Source/x64.inc |
Unfortunately I don't recall where the examples are, from which I learned about RegisterFunctionName. With RegisterFunctionName you specify the @HandlerFunc, and Ext1, Ext2. The latter 2 are passed to HandlerFunc. For properties you have a read and a write method. So you can specify a pair for each of them. Of course you can also set 2 (read/write) new HandlerFunc for each of property. In the linked code the HandlerFunc is ExecBasicHandler. Btw, the last commit 86a057c, seems to change InnerfuseCall to InvokeCall. But that is Delphi only. It does not affect FPC. |
latest commit not tested and do not work/compilation on previous delphi versions (sample XE3 not compiled). Need fix: #203 (comment) |
About your commit / link: Those things should be defined per platform. But then (search the recent fpc mail list) fpc changed it for 32bit linux. |
For x64 platform - simple call notations. |
For plain procedures/functions there are
RegisterDelphiFunction which emulates a native call
RegisterFunctionName which avoids "playing" with the stack
For methods this does not exist.
I added
TPSRuntimeClass.RegisterMethodName and TPSRuntimeClass.RegisterPropertyNameHelper
The name RegisterPropertyNameHelper may need to be changed, but RegisterPropertyHelperName was already taken.
Using those functions should be more resistant against changes in the compiler.
According to the fpc mailing list, fpc trunk changes calling convention on i386 linux...