…that fail during garbage collection
The type inference on the Cmm code now assumes every let-binding can contain a pointer. Every argument of function calls and alloc instructions is computed, saved on the stack. They are loaded as soon as they are needed to call the function/store the values. It seemed like this might fix the GC-problem, but it did not. During garbage collection some strange bugs occur...
…ime and the standard library without copying the the latter two to a new directory
…caused them not to return their actual result.
… containing pointers on the stack Otherwise the garbage collector would not be able to replace those pointers by new ones when necessary. This does not currently handle all cases, because my (very simple) type inference algorithm sometimes mistakenly thinks of variables as integers when they can actually be pointers. So in some cases the pointers get changed correctly during garbage collection but not all cases.
…ead of inttoptr(i64 12456789 to i64*)
…e does not need This includes options for dumping intermediate data as well es the data structures used to represent that data. In particular Mach and Linearize are replaced by a variante used for generating LLVM IR. Any code used for register allocation as well as a lot of amd64-specific code are removed completely.
For that to work I added code to work around what seems to be a bug in LLVM occuring when using gcroot with the ocaml gc. Also a bug concerning exception handling that caused an infinite loop in certain when an exception was thrown in a try-with-block that was not caught in that block. Furthermore changed the runtime code a bit to work with the new exception handling.
…ating point numbers and a few others The generated LLVM was totally wrong for catch statements. The with block was always executed, not just when using the exit statement.
…ate representations Also fixed the bug that caused floating point numbers to be printed with a '.' as the last character, whether there was one already or not. Instead the '.' is now only printed, when the fractional part is not 0.
…ions. They are inspired by the Mach and Linearize representations.
…atements to be undefined
The pointer to newly allocated n (n>4) words of memory was stored in %r11 instead of the return register %rax.
Every function is declared as 'nounwind' because the LLVM backend is supposed to use setjmp/longjmp based exception handling. Additionally, to make the generated native assembly easier to read, the functions are declared as 'noinline', so LLVM does not inline any calls. This may be reverted when the main debugging phase is over.
The offsets calculated when handling a Calloc were intended to be word offsets but were used as byte offsets. Programs containing integer arithmetic, printing integers and references work as expected. However, converting float to string does not work at the moment while converting float to int does.
- added the asmrun, byterun and config directories from the OCaml distribution - fixed a bug that caused the compiled code to load data from the wrong address (in particular it looked for some data at an n word offset instead of an n byte offset) - moved the type definitions for the intermediate data to a separate module