-
Notifications
You must be signed in to change notification settings - Fork 36
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
How to cover BCL interfaces/implementations by semi-automatically aggregation for around members. #91
Comments
It is worth looking at https://github.com/nanoframework/CoreLibrary
I will try to compile it with IL2C, to see how much effort needed to be put into full blown implementation of it for IL2C.
|
We need to extract automated how much lack members on IL2C. I think it difficulty topic:
|
Indeed, it is a difficult topic. I think, we need to pick a BCL implementation, and work against it, otherwise it will be an endless effort to build it from bottom to up. If we can make IL2C compile such an mscorlib into C, it will produce the same naming convention otherwise used in the app. I looked at the Microsoft's implementation of BCL (mscorlib) a bit, tried to put together a stripped down version for a few days, but has a lot of problems:
The nanoFramework seems to be a fairly complete reimplementation of .NET, with much fewer methods, and all of those are not implemented in IL (C#), are internal.calls, and on top of that: it was specifically designed with resource constrained embedded systems in mind. (Just like IL2C, as I understand) By compiling mscorlib into C, we would get the proper class descriptors, vtables, stack frames, everything, for even the method stubs. Those could be removed from the IL2C.Runtime files, and only leave the actual method implementations. Than trying to compile the mscorlib against the framework with gcc, would result in a well identifiable error messages, which methods don't have an implementation (the compile log could be 'grep'-ed for those, I think). When we have identified the methods, not there in the IL2C.Runtime, we can generate those with a simple body, throwing NotImplementedException. And start to implement those, eventually. If we fork from nanoFramework.CoreLibrary, we can even choose where to implement the missing parts: C# side, or C side. |
I will read/check too nanoFramework.CoreLibrary, I feel will take some idea from it. It may be difficult to port nanoFramework.CoreLibrary as it is. (Because there is a difference between AOT and interpreter) |
According to my initial tests with compiling nanoFramework's mscorlib, I see the following path would be viable to have an optional "external" mscorlib implementation:
If after these changes compilation succeeds, we will have a new runtime static library, with external references to methods not implemented, and this could be collected probably with libtools somehow. EditDon't need to patch the generated C code, instead I introduced the Interop attributes in nanoFramework, and used to annotate NativeType all the simple types, except for the Delegate and MulticastDelegate. |
I bit understood your strategy :) Would you tell me about my understanding is correct:
The difference between the list of symbols obtained from a normal IL2C binary and the CoreLibrary combined binary is probably insufficient and it's close up next step for our implementation. |
Yes, something close. The produced combined library will contain a lot of extern symbols, which will be coming from the CoreLibrary's methods, annotated with |
I understood it! Would you make ready to review for branch (I feel you will make on |
I think it is ready to review. In the meantime, I will stop working on the |
TODO:
The text was updated successfully, but these errors were encountered: