UDIS86: fixed crash caused by keeping `ud_t` structure on smalltalk heap
...and this the structure may move. Thisx resulted on hard-to-debug heap
corruptions because `ud_t.asm_buf` is initializad to a pointer to
`ud_t.asm_buf_int`. Therefore when the bytearray moved, the pointer
become invalid and subsequent call to `ud_disassemble()` smashed whatever
object happened to be where the bytearray were.
The fix is straigtforward, use `ExternalBytes`! Sigh.
# DragonFly Experimental Compiler
**DragonFly** is an experiment aiming to build a compiler for [Smalltalk/X][1]
in Smalltalk on top of [LLVM][2] toolchain (hence the "Dragon" :-)
DragonFly consists of:
* **jv:dragonfly** - contains Smalltalk interface to the Smalltalk/X VM providing an API to allocate and access garbage-collected machine code and data sections.
* **jv:dragonfly/asm** contains a port of Igor Stasenko's AsmJIT i386 and x86_64 assembler (thought x86_64 support is broken)
* **jv:dragonfly/udis86sx** contains Smalltalk binding to [UDIS86][3] i386 and x86_64 disassembler.
* **jv:dragonfly/c1** contains an (unfinished) experimental JIT compiler based on LLVM. Depends on [jv:llvm_s][8].
## Installation
Since **jv:dragonfly** contains a C code, you need to have working build environment
for building Smalltalk/X jv-branch. For details see [Building Smalltalk/X jv-branch from sources][9].
Following steps assume you have built Smalltalk/X in directory {{{stx_jv}}}.
**1.** Clone the repository:
```
#!bash
mkdir -p stx_jv/build/jv
hg clone https://bitbucket.org/janvrany/jv-dragonfly stx_jv/build/jv/dragonfly
```
**2.** Build it:
```
#!bash
cd stx_jv/build/jv/dragonfly
make
```
On Windows, do
```
#!bash
stx_jv\bin\setenv.bat
cd stx_jv\build\jv\dragonfly
mingwmake
```
**3.** To load it into running Smalltalk/X IDE, execute:
```
Smalltalk loadPackage: #'jv:drgonfly'. "Loads basic support"
Smalltalk loadPackage: #'jv:drgonfly/asm'. "Loads AsmJIT, a i386 assembler"
Smalltalk loadPackage: #'jv:drgonfly/udis86sx'. "Loads UDIS86, an x86 disassembler"
Smalltalk loadPackage: #'jv:drgonfly/c1'. "Loads unfinished C1 compiler"
```
Note, that for C1 compiler you need to have also [jv:llvm_s][8]
## Usage
See various example classes and tests, namely:
* [CompiledCodeObjectExamples][10]
## Author
Jan Vrany `<jan.vrany [at] fit.cvut.cz>`
## License
Different parts are licensed under different licenses.
* **jv:dragonfly** - [MIT][4]
* **jv:dragonfly/asm** - [MIT][5]
* **jv:dragonfly/udis86sx** - [BSD][6]
* **jv:dragonfly/c1** - [free for experimenting, no commercial use][7]
[1]: https://swing.fit.cvut.cz/projects/stx-jv/
[2]: http://llvm.org/
[3]: https://github.com/vmt/udis86
[4]: https://bitbucket.org/janvrany/jv-dragonfly/src/default/license.txt
[5]: https://bitbucket.org/janvrany/jv-dragonfly/src/default/asm/license.txt
[6]: https://bitbucket.org/janvrany/jv-dragonfly/src/default/udis86sx/license.txt
[7]: https://bitbucket.org/janvrany/jv-dragonfly/src/default/c1/license.txt
[8]: https://bitbucket.org/janvrany/jv-llvm-s
[9]: https://swing.fit.cvut.cz/projects/stx-jv/wiki/Documentation/BuildingStXWithRakefiles
[10]: https://bitbucket.org/janvrany/jv-dragonfly/src/default/CompiledCodeObjectExamples.st