Giter VIP home page Giter VIP logo

Comments (8)

tgiphil avatar tgiphil commented on June 23, 2024

@charsleysa Sounds good.

from mosa-project.

charsleysa avatar charsleysa commented on June 23, 2024

@tgiphil what exactly are we missing in terms of generics?
Most if not all of the functionality is already there.

from mosa-project.

tgiphil avatar tgiphil commented on June 23, 2024

@kiootic can answer that better than I could.

from mosa-project.

charsleysa avatar charsleysa commented on June 23, 2024

@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.

kiootic avatar kiootic commented on June 23, 2024

@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.

charsleysa avatar charsleysa commented on June 23, 2024

@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.

charsleysa avatar charsleysa commented on June 23, 2024

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.

tgiphil avatar tgiphil commented on June 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.