You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 12, 2024. It is now read-only.
At present, we wrap any function in swift that (1) doesn't match the platform function call ABI and (2) calls a virtual method.
Quick rundown - on x64, the swift function call ABI follows these rules:
All value types are passed by value if they take 3 machine words or fewer.
If a value type is more than 3 words, a copy is made and it is passed by reference.
The instance/context pointer for a method is passed in R13.
If a function throws, it will set R12 to the exception
If we can implement in mono the ability to selectively match the function call ABI then we can eliminate most of the wrapper code that SoM generates.
This doesn't solve the issue of invoking virtual methods since, to date, we have no means of finding the correct vtable entry to call. Swift 5 has added a set of data structures and associated calls that let us do this.
For every major language element, there is an associated descriptor for it.
For example, there exists this new call:
Which returns a method for a given method descriptor.
I suspect that this is in place for either:
writing a better debugger
calling code via reflection
Nonetheless, we should be able to (mis)use this to call virtual methods without wrapping them.
The text was updated successfully, but these errors were encountered:
At present, we wrap any function in swift that (1) doesn't match the platform function call ABI and (2) calls a virtual method.
Quick rundown - on x64, the swift function call ABI follows these rules:
All value types are passed by value if they take 3 machine words or fewer.
If a value type is more than 3 words, a copy is made and it is passed by reference.
The instance/context pointer for a method is passed in R13.
If a function throws, it will set R12 to the exception
If we can implement in mono the ability to selectively match the function call ABI then we can eliminate most of the wrapper code that SoM generates.
This doesn't solve the issue of invoking virtual methods since, to date, we have no means of finding the correct vtable entry to call. Swift 5 has added a set of data structures and associated calls that let us do this.
For every major language element, there is an associated descriptor for it.
For example, there exists this new call:
Which returns a method for a given method descriptor.
I suspect that this is in place for either:
writing a better debugger
calling code via reflection
Nonetheless, we should be able to (mis)use this to call virtual methods without wrapping them.
The text was updated successfully, but these errors were encountered: