TC-H Samples
Note
When testing your implementation, it may be a good idea to look at both the LLVM-IR and Assembly outputs.
Note
There is not a single good implementation of a garbage collector. Do not hesitate to test new ideas and tune your collector with various approaches !
print-concat.tig
print(concat("Hello", " Tigrou !"))
Using the llvm-gc-debug mode, we force the runtime to free every object before the program exit. Additional checks can also be added at runtime. You are strongly advised to use Valgrind, The Ultimate Memory Debugger to help you debug your runtime.
$ tc --llvm-gc-debug --llvm-gc-runtime-link --llvm-runtime-display --llvm-display print-concat.tig > print-concat.ll
$ clang print-concat.ll -oprint-concat
$ valgrind ./print-concat
$ Hello Tigrou !
Note
Depending on your implementation, valgrind may report errors such as invalid reads. You should take a look at every report and ensure you can make the difference between expected and actual errors.