summaryrefslogtreecommitdiff
path: root/examples/run_func.c
diff options
context:
space:
mode:
authorTom Harley2019-10-29 17:14:56 +0000
committerTom Harley2019-10-29 17:14:56 +0000
commit42c26919532146b887b134430c4713709b7a4d75 (patch)
treedf339b5af52f009dfec9b0fb39be0b4fe768f254 /examples/run_func.c
parentAdd struct type definitions (diff)
downloadsinter-42c26919532146b887b134430c4713709b7a4d75.tar.gz
sinter-42c26919532146b887b134430c4713709b7a4d75.zip

Box everything

Everything now gets reduced to an i8*, either through placing on the heap (in the case of primitives) or just through a simple pointer cast.

In the case of primitives, boxing might be avoided by casting the primitive to an i8*, however this would only work for primitives with sizes less than or equal to the size of a pointer on the system.

Boxing increases the generated LLVMIR size dramatically, so it is probably worth looking into ways to reduce the frequency of boxing. One option is to keep track of whether or not a value has been boxed, and only boxing/unboxing it when necessary instead of all the time.

The current implementation uses LLVMBuildMalloc, which allocates memory, but does not ever free this memory. Freeing boxes once its value is extracted may be safe, though I’m not certain. It may be worth looking into LLVM’s garbage collection support at this point.

Diffstat (limited to 'examples/run_func.c')
0 files changed, 0 insertions, 0 deletions