Giter VIP home page Giter VIP logo

Comments (4)

CensoredUsername avatar CensoredUsername commented on May 24, 2024

Probably the best way to do this is very soon after parsing, looking through all immediate arguments that don't have a size set, checking if their ast::expr is a simple integer literal and then setting the size based on the value of this integer literal. In the future const-folding might be possible here for additional optimizations but this'd really be something for another crate.

from dynasm-rs.

CensoredUsername avatar CensoredUsername commented on May 24, 2024

Has been looked into with 1031ddf which adds immediate size based optimisations. However, this still leaves displacement size optimizations, where decent improvement should also be possible.

from dynasm-rs.

CensoredUsername avatar CensoredUsername commented on May 24, 2024

Displacement optimization has been added with 976162e for simple memory references. Currently working on their support in typemaps

from dynasm-rs.

CensoredUsername avatar CensoredUsername commented on May 24, 2024

Due to the mechanics of typemaps, it is impossible to do displacement optimizations on them without additional information, as the size of the type is unknown. Observe the following case:

rax => Foo[2].bar

The plugin can only compile this down to [rax + (size_of<Foo>() * 2 + offset_of!(Foo, bar))] which is not simply statically evaluatable. As in any case of a typemap, the size_of multiplication will still be present this means that without extra information typemaps cannot be automatically optimized to byte-sized displacements.

However with commit c1e9ca3 support for manual optimizations (with the BYTE and DWORD keywords used after the opening bracket) has been added.

With this I consider this issue closed as any other immediate optimizations would rely on compile-time ast evaluation, for which the ecosystem is still too immature.

from dynasm-rs.

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.