Coder Social home page Coder Social logo

Comments (2)

jameysharp avatar jameysharp commented on May 8, 2024

Yes, I want this. 😄

I've been wondering: can the intermediate form you mention just be Rust source code? It's hardly efficient to have to re-parse the text, but I hope nobody will replace their regular compiler with Corrode, so I don't think we should worry much about runtime efficiency.

And to what extent do we need any cross-module analysis to get the translation to work? We'll definitely need cross-module analysis to make the generated code properly follow Rust idioms, but I'm deferring that problem to a later tool. I'm guessing that with everything marked #[no_mangle], cross-module references to functions and global variables should work fine; and although type definitions will be duplicated in every module that uses them, that should still lead to correct code being generated.

Regarding inline in particular: it's just a performance hint, not a requirement for correctness. We can do some conservative translation that ensures the function is callable everywhere it's supposed to be, without guaranteeing that it will be inlined everywhere GCC would have inlined it, if that makes the translation feasible.

from corrode.

eternaleye avatar eternaleye commented on May 8, 2024

The difficulty with inline isn't making sure it's callable; it's making sure that the symbols don't collide when you have multiple definitions, not merely multiple declarations.

Similarly, that implies that Rust would be a poor intermediate form, because it would lose some of those distinctions.

Or in other words, the difference between Rust's #[inline] and C's inline is that C's inline is a requirement for correctness at link time.

from corrode.

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.