Skip to content
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

Suggestion about Assembly.Save and Expression.CompileToMethod #278

Open
LonghronShen opened this issue Nov 15, 2023 · 7 comments
Open

Suggestion about Assembly.Save and Expression.CompileToMethod #278

LonghronShen opened this issue Nov 15, 2023 · 7 comments

Comments

@LonghronShen
Copy link

  1. In .NET 8, we finally get a way to save the Assembly. See AssemblyBuilderImpl
  2. As for the missing of CompileToMethod, we may use this library as a workaround?
@fMichaleczek
Copy link

  1. It may not even be usable on the net9.0 branch. It's active but it will be on the LTS branch and without promise of MVP in november 2024 . I am confident but we have seen on WASM multithreading that there may be technical constraints which delay it by 2 years.
    Tracking issue for remaining AssemblyBuilder.Save work in .NET 9 dotnet/runtime#92975

  2. InMemory, no debug File, no validation. It's good for a small lib but not for a DLR engine with language platforms. The tooling around the lib has not the requirement to debug a wide system.
    https://github.com/yantrajs/yantra/wiki/Expression-Compiler#no-validation

@LonghronShen
Copy link
Author

Good point. I mean, to what extent can we make a workaround solution. This may lead to some suggestions about refactoring the architecture of the DLR framework which allows us to inject some workaround into the framework.

@LonghronShen
Copy link
Author

For the AssemblyBuilder feature, it has been released in .NET 9 and it has been used in IronScheme.
See dotnet/runtime#92975 (comment)

@LonghronShen
Copy link
Author

I found that there is an old implementation of the LambdaCompiler in the very old commit for the DLR. Is is possible to get this one back here to be the altnative to the missing CompileToMethod for .NET Core?

@slozier
Copy link
Contributor

slozier commented Dec 31, 2024

I did attempt to port over the compiler before but quickly ran into issues. The StackSpiller was the big roadblock with it making use of internals of System.Linq.Expressions expressions which are not available via public API. Some of them were relatively easy to work around by copying the implementation to extension methods but others were causing more issues (for example all constructors are internal so classes cannot be derived or easily instantiated).

I might try again at some point if I can think of some workarounds. I'm open to suggestions.

@fMichaleczek
Copy link

IKVM.Reflection is still alive but I dont know if still apply
https://github.com/ikvmnet/ikvm/tree/main/src/IKVM.Reflection

System.Expression is frozen, some improvement are already here but dotnet team will never integrate them ..
https://github.com/bartdesmet/ExpressionFutures

bartdesmet has given all his lib around Expression on this repository/website, there is a book in the website that explain 10 years at Bing and Expressions
https://reaqtive.net/download/index.html
https://github.com/reaqtive/reaqtor/tree/main/Nuqleon/Pearls/LINQ/BinaryExpressionSerialization

There is also this project who give a lot of feedbacks
https://github.com/re-motion/TypePipe
https://github.com/re-motion/TypePipe/wiki/Expression-Tree-Issues

Runtime Labs have 2 interesting projects around the interpreter (dont know if they go somewhere) :
https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-Mint/src/coreclr/nativeaot/docs/mint.md
https://github.com/dotnet/runtimelab/tree/feature/CoreclrInterpreter

The spec for runtime async is starting (no hope but who knows ! )
https://github.com/dotnet/runtime/blob/main/docs/design/specs/runtime-async.md

I don't have the level to mix all that and produce something but if it could help an experienced developer;

@LonghronShen
Copy link
Author

I gave a try yesterday and I think we may also port all the Expression related things back here just like the Yantra's Compiler do to make a whole copy of the SLE staff in parallel. See this:
Scripting.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants