Open timotheecour opened 3 years ago
Cling has LibClang and LLVM as dependency, that adds 3 big dependencies to the Nim compiler. :thinking:
Whats a quick feature compare of Cling vs LibClang ?
one is based on the other; I'm still exploring but at least cling adds a REPL, and use as a binary instead of having to link in libclang as library dependency, but I'm definitely not discarding using libclang directly, this needs more though.
Does this really meant to be a new Backend?, or a replacement/evolution of the VM ?.
some of the use cases don't involve a new backend: (eg making things like this possible: const foo {.importc:”C_ISSOCK”.}
, or making CT ffi easier); others involve speeding up VM by doing jitting of vm code for hotspots, and yet other use cases involve replacing the existing (or deprecated) tcc backend with have with cling (which supports C++, and more platforms, than tcc; we'll need performance comparisons)
Does Cling work with C ?, docs only mention C++.
see other docs: Cling
Cling is able to parse everything that clang can [...]
Clang has support of C, objC, objC++ and we are looking forward to having more use-cases and extend our tool in that direction.
Does that allow easy dynamic linking compilation?
still exploring but this could be an advantage over using libclang directly, ie by invoking cling as a binary instead of linking as a library. TBD.
Cling has LibClang and LLVM as dependency, that adds 3 big dependencies to the Nim compiler.
that's fine if the dependency is optional. on osx (and other platforms probably the same) it's as simple as brew install cling
. If user can get CT speedup or CT FFI using this, it's good enough of a use case.
Another option to research: https://www.keystone-engine.org/docs/beyond_llvm.html
example use cases
links
vmhook
: user defined vmops:proc fn(): int {.vmhook.} = impl
to JIT-compile and dlopenfn
at CT (using regular backend, not VM) · Issue nim-lang/Nim#598 · timotheecour/Nimmir c2m JIT c compiler
gcc -O2
on some benchmark (generated code quality) (tcc: 0.5x)gcc -02
, 2x faster thangcc -O0
(tcc: 180x faster thangcc -O2
)cling