[LLVMdev] Newbie questions

Archie Cobbs archie at dellroad.org
Sun Apr 23 07:43:12 PDT 2006


I'm just learning about LLVM (really interesting) and have some newbie
questions. Feel free to ignore or disparage them if they're inappropriate :-)

My area of interest is using LLVM in a Java JVM setting. These are
just some random questions relating to that...

1. What is the status of the LLVM+Java effort? Is it GCJ-specific?
    Is there a web page? I found one link via google but it was broken.

2. I'm curious why the LLVM language includes no instructions for memory
    barriers or any kind of compare-and-swap (bus locking operation). Were
    these considered? Were they deemed too platform-specific? What about
    some definition of the atomicity of instructions (e.g., is a write of
    a 32 bit value to memory guaranteed to be atomic)? More generally does
    the LLVM language define a specific (at least partial) memory model?

3. Would it make sense to extend the LLVM language so that modules,
    variables, functions, and instructions could be annotated with
    arbitrary application-specific annotations? These would be basically
    ignored by LLVM but otherwise "ride along" with their associated items.
    Of course, the impact on annotations of code transformations would have
    to be defined (e.g., if a function is inlined, any associated annotations
    are discarded).

    The thought here is that more optimization may be possible when
    information from the higher-level language is available. E.g. the
    application could participate in transformations, using the annotations
    to answer questions asked by the LLVM transformation via callbacks.

    To give an example (perhaps this is not a real one because possibly it
    can already be captured by LLVM alone) is the use of a Java final instance
    field in a constructor. In Java we're guaranteed that the final field is
    assigned to only once, and any read of that field must follow the initial
    assignment, so even though the field is not read-only during the entire
    constructor, it can be treated as such by any optimizing transformation.

4. Has anyone written Java JNI classes+native code that "wrap" the LLVM API,
    so that the LLVM libraries can be utilized from Java code?


Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

More information about the llvm-dev mailing list