Comments (8)
@charsleysa Sounds good.
from mosa-project.
@tgiphil what exactly are we missing in terms of generics?
Most if not all of the functionality is already there.
from mosa-project.
@kiootic can answer that better than I could.
from mosa-project.
@tgiphil well until then I've made a few modifications that fixes the problems with Metadata not knowing about generics. All tests pass so I will merge into main repo.
from mosa-project.
@charsleysa At the moment, generic type/method instantiation are handled by the type system when loading assemblies. It might be better to move that part to the compiler. Also there is code duplication due to copies of type are produced for each generic instantiation. It would be beneficial to implement your proposal.
from mosa-project.
@kiootic while my solution my be better I don't think I have the necessary skills to be able to implement it and so I'll be leaving it for now and focussing on finishing the Runtime side of the new Metadata System.
The current solution works which is the important part, optimization can be done afterwards.
from mosa-project.
I have looked into this some more and the method I proposed would only work when all the generic parameters are reference type.
If even one generic parameter is a value type then another duplicate would have to be made that can't share the same.
While we would benefit from smaller binaries I think the amount of work that it would currently take would outweigh the benefits received. (Currently binaries are less than 2MB).
from mosa-project.
In the short-term, the linker could maintain a hash of the binary code of the method. And upon a collision, each byte could be compared. If an exactly match is found, the methods are the same. The linker then only emits one of the methods and the other method(s) are re-directed to the address of the emitted method.
The upside of this short-term solution is that it's almost trivial to implement and immediately reduces code bloat due to generics (and possibly other simpler methods as well). The downside of this method is the compiler continue to do work that is later discarded that could have been avoided by an analysis of the generic type usages.
from mosa-project.
Related Issues (20)
- Add X64 Popcnt/Tzcnt/Lzcnt/AndN instructions
- Add x86 IMul instruction
- BUG: Launcher tool missing command line auguments HOT 1
- Add Methods to Korlib
- Integrate Visual Studio Debugger
- BUG: Unit test failures with Release build HOT 2
- Compiler cannot compile `System.Runtime.CompilerServices.NullableAttribute` HOT 2
- Add Serial Debug Logging
- Add Hardware Abstraction Layer (HAL) to BareMetal
- Clean up build annotations and warnings
- Integrate Unit Test Engine into BareMetal
- Assertion fails during ComputeArgumentSize HOT 7
- Adding DeviceService to ServiceManager causes a `System.IndexOutOfRangeException` HOT 2
- BUG: Conversion from R4/R8 to U4 HOT 2
- Add ARM64 Opcodes HOT 3
- Create ARM64 Projects HOT 2
- Add ARM32/ARM64 Launch options to Qemu HOT 1
- Support VMware Workstation GDB Stub
- Add Intel SARX/SHLX/SHRX instructions
- Add X86 Popcnt/Tzcnt/Lzcnt instructions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mosa-project.