Reply-To: (Richard)
legalize+jeeves@mail.xmission.com
[Please do not mail me a copy of your followup]
Utah C++ Programmers has released a new video.
JIT Code Generation with AsmJit
<
https://www.youtube.com/watch?v=HkThHWX_lgU>
What do you do if you have some sort of user-defined expressions
that you need to evaluate? Let's assume you have some way of
parsing that text into a meaningful data structure, such as
an abstract syntax tree (AST). The obvious answer is to write
some code that traverses your AST and acts as an interpreter to
produce the results.
Iterated Dynamics[*] has a "formula" fractal type that allows
you to write your own little formula for iterating points in
the complex plane in order to define your typical "escape time"
fractal. Currently, the code uses an interpreter approach as
described above.
However, this interpreted formula is in the inner loop of the
image computation. The original MS-DOS FRACTINT code had a
just-in-time (JIT) code generator for the 8087/80287/80387 math
coprocessor that would compute the formula described by the user's
input. Because this code was executing natively on the hardware,
it outperformed any interpreter.
This month, Richard Thomson will give us an overview of the AsmJit
libraries for generating in-memory machine instructions that we
can call from C++. We'll look at how AsmJit exposes the assembly
and linking process and the tools that it provides beyond the
basic process of storing machine code into memory.
AsmJit: <
https://asmjit.com/>
Sample code: <
https://github.com/LegalizeAdulthood/asmjit-example>
[*] <
https://github.com/LegalizeAdulthood/iterated-dynamics>
--
"The Direct3D Graphics Pipeline" free book <
http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <
http://terminals-wiki.org>
The Computer Graphics Museum <
http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <
http://legalizeadulthood.wordpress.com>
--- MBSE BBS v1.1.1 (Linux-x86_64)
* Origin: multi-cellular, biological (3:633/280.2@fidonet)