Closed aquynh closed 8 years ago
Thanks!
In case you are interested, I have just finished the Getting Started wiki page.
i havent looked at the source yet. can you give a quick explanation how this was done? do you need to translate machine code to IR?
No. It contains a x64 runtime assembler and a "sandbox" JIT. The assembly is generated and executed on the fly. Then, fitness is determined by comparing written registers to the expected output.
How do you generate assembly: randomly, or with any strategy? What if you have to combine more than 1 instruction to get the desired result?
Initially, the population is seeded randomly, yes. From then on it's a classical evolutionary process. A program, usually, indeed is longer than a single instruction. I compiled an extensive list of instruction information that helps with generating only valid sequences.
this is interesting!
not sure what assembler you are using, but you might be interested in Keystone, a "sister" of Capstone: www.keystone-engine.org
It contains its own assembler :).
BTW: It would be interesting to compile such tables for different architectures, that could be shared across multiple projects. Also, autogenerated assemblers are so much more maintainable.
what is practical usage of Awasm?
Good question. My goal is to have something that lies between a program synthesizer and a superoptimizer. Awasm might implement simple programs (actually functions) in ways human would never think of. Of course, classical superoptimizers will usually produce better code in terms of size or performance, but Awasm doesn't need an ordinary compiler to bootstrap the search process (generate the initial assembly).
So, on the long run, you might build something like a language compiler whose code generation is based on examples, or a more complex program synthesizer, or a simple tool that helps with writing assembly by hand: it will propose a baseline program, that can be improved on manually.
this looks amazing! sounds like program synthesis to me.
linked to your tool just now from our website: http://www.capstone-engine.org/showcase.html
keep it up, cheers.