Comments (4)
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.
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.
Displacement optimization has been added with 976162e for simple memory references. Currently working on their support in typemaps
from dynasm-rs.
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)
- The memmap crate is no longer maintained. HOT 8
- Incorrect instruction encoding on aarch64 HOT 4
- Is emitting text output possible? HOT 2
- Broken link to the documentation HOT 2
- How to choose assembler for shellcode generation HOT 2
- Impossible relocation on x86 HOT 2
- Panic when trying to use 0xff as immediate for a logical operation HOT 6
- Switch to github actions
- Can't encode repne scasb HOT 1
- Website link in the repo's "About" section is wrong HOT 3
- Example of how to run a PE32 executable/library? HOT 7
- Feature request: compile-time resolution of "super-local" label HOT 5
- Language dialect reference for AArch64 has some stale x86/x86-64 references HOT 2
- omit known zero offset HOT 2
- Consider using `MAP_JIT` on macOS HOT 1
- Link to GitHub pages is broken HOT 3
- Question: dynamically replacing code while running it HOT 4
- Executable buffer relocations HOT 5
- ImpossibleRelocation error on seemingly valid AArch64 code HOT 4
- Aarch64: mov w0, immu32 expects a u64 when encoded at runtime
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 dynasm-rs.