digitalmars.D.announce - Dlang dynamic compilation
- Ivan Butygin (43/43) Nov 21 2016 Hi all
- =?UTF-8?B?Tm9yZGzDtnc=?= (2/4) Nov 22 2016 This could be used to accelerate genetic algorithms at run-time.
- Faux Amis (3/7) Nov 22 2016 https://en.wikipedia.org/wiki/Genetic_algorithm
- Minty Fresh (7/9) Nov 22 2016 Very cool. Although @runtimeCompile does peeve me, as it seems
Hi all Here is my small project - ability to move some code optimization and generation to runtime. Any function can be marked with special attribute and llvm bitcode for it will saved in binary. Then during runtime it will be optimized and compiled (and it can use best available cpu instructions). runtimeCompile void bar() { ... } ... // Somewhere in main rtCompileProcess(settings); // Compile bar(); Another feature - ability to create "runtime compiletime variables" - you can set them during runtime and then they will be treated as constants during optimization and codegeneration. runtimeCompile __gshared int var; runtimeCompile void bar() { // var is treated as constant in generated code and subject to constant propagation, loop unrolling, etc foreach(int i; 0..var) { } if(var == 42) // This block will be removed comletely if var is not 42 { } } // Somewhere in main var = 42; rtCompileProcess(settings); // Compile bar(); var = 13; // To see changed value in runtime compiled code recompilation is required rtCompileProcess(settings); // Compile bar(); This is an early prototype and mostly untested but simple examples work. Hacked ldc sources are here: https://github.com/Hardcode84/ldc/tree/runtime_compile
Nov 21 2016
On Monday, 21 November 2016 at 18:59:17 UTC, Ivan Butygin wrote:Hacked ldc sources are here: https://github.com/Hardcode84/ldc/tree/runtime_compileThis could be used to accelerate genetic algorithms at run-time.
Nov 22 2016
On 2016-11-22 12:51, Nordlöw wrote:On Monday, 21 November 2016 at 18:59:17 UTC, Ivan Butygin wrote:https://en.wikipedia.org/wiki/Genetic_algorithm ;)Hacked ldc sources are here: https://github.com/Hardcode84/ldc/tree/runtime_compileThis could be used to accelerate genetic algorithms at run-time.
Nov 22 2016
On Monday, 21 November 2016 at 18:59:17 UTC, Ivan Butygin wrote:Hacked ldc sources are here: https://github.com/Hardcode84/ldc/tree/runtime_compileVery cool. Although runtimeCompile does peeve me, as it seems unnecessarily verbose (being longer than any other attribute, I think). I'd have gone with rtc or similar so as not to clutter function and variable declarations, but those are just my thoughts on language readability.
Nov 22 2016