-
Notifications
You must be signed in to change notification settings - Fork 4
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
Any update? #3
Comments
Hi, the project is far away from running anything useful - almost nothing of the .NET "standard library" is implemented, so it's mostly a fancy calculator for fibonacci numbers and such :) One part that should be pretty much complete is the parser. Important omissions by the runtime include generic types, 22 CIL instructions, and others. I am currently completing the thesis text which should describe the state of the implementation as close as possible. Performance benchmarks will come in the next weeks. |
That's cool, I'm very enthusiastic about this project!
|
I hope @jagotu won't mind if I comment on this. The path forward is IMO to reuse as much as possible from the reference implementation, which is OSS with suitable license AFAIK, so basically to follow the approach of the Java bytecode interpreter Espresso (AKA Truffle Java): implement the P/Invoke and any other features/compiler intrinsics that the standard library is using. From our experience of implementing alternative language runtimes reimplementing standard library is:
JVM does not directly support value types or stack allocation, but Graal compiler's escape analysis may remove allocations/stack allocate those C# constructs in many cases if the interpreter is crafted well. On top of that it may escape analyze even C# reference classes. tl;dr: for now I am not aware of any feature that could not be implemented on top of Truffle/GraalVM. |
Great points! Note that there was this proposal from Microsoft: A missing feature would be explicit SIMD. I mean yes openjdk has gained the vector api and it is great, but it doesn't have feature parity with the C# equivalent. Also C# do not have type erasure. Java will support reified generics once value types ships but it's not there. Kotlin can emulate reified generics on the JVM but only for inline functions. (or they could for all but don't because of java interop? I don't know) While the 2 first needs are not generally used in common C# code, type erasure might show more frequently. |
The semantic aspects of all those things like that structs are value types or reflection on generic C# types will be emulated in Truffle CIL interpreter, but the interpreter should be crafted in a way the the emulation compiles down to the same/similar machine code as C#/MSIL JIT compiler would produce. We are not talking about some CIL to Java bytecode translator. C# classes will not be directly translated for Java classes etc. They will be emulated, but thanks to Truffle this emulation will eventually compile down to efficient machine code. One thing that can be exciting is the project loom on JDK. Truffle CIL interpreter would allow to run C# on lightweight user space threads. |
@LifeIsStrange I completed the completeness and benchmarks chapters in the thesis. To answer the question "What kinds of programs can it currently run?", the short answer is that it's just a fancy calculator - don't expect it to run anything more than calculations and basic operations on classes and structures. While we tried to defer to .NET's standard library implementation, it heavily relies on generics and other features we don't support, so calling any library methods usually ends with an error. The benchmarks are also there, with the conclusion being (after warmup) it's within order of magnitude of .NET's performance. |
Hi @jagotu !
Your project looks amazing :)
Any update??
What kinds of programs can it currently run?
I know it's a bit early but your project would get public attention if you published interesting benchmarks.
The text was updated successfully, but these errors were encountered: