[LLVMdev] Using LLVM for a dynamically typed language

Vladimir Prus ghost at cs.msu.su
Thu Apr 21 07:51:25 PDT 2005


On Thursday 21 April 2005 18:28, Vyacheslav Akhmechet wrote:
> Evan,
>
> The problem is that I do not know the type of a target function at
> compile time. If you consider my code example, I don't know the type
> of 'i' until runtime (in fact, I can't even know a possible range of
> types 'i' may assume).

But... in a dynamic language each variable must have an associated type 
information? So, why can't you use LLVM struct consisting of
- integer type code (or anything else you like)
- pointer to void which holds the actual data.

What you're doing is rather interesting. There's IronPython which implements 
Python (a highly dynamic language) on top of .NET and which claims to be 2x 
faster than regular Python. However, I never seen any implementation details 
so don't know how dynamic features are dealt with. 

- Volodya




More information about the llvm-dev mailing list