[LLVMdev] vmkit variables internal representation

Alexandru Ionut Diaconescu cyrusthevirus001x at yahoo.com
Tue Jun 25 07:09:06 PDT 2013


Hello everyone !

I am quite new to java under LLVM. I have the following code in Java:

class MYGL {
public static int P;
public static int balance;
}

        int Q;
        MYGL.P=5984;
        Q=4597;
        MYGL.balance=Q+6094;

For the local variable Q, it seems that the compiler is optimizing and considering store i32 10691, i32* .... (into balance). Do you know how I can compile the code for preserving Q? 

I have the commands:
javac -Xlint -g -O Main.java
....vmjc Main
.....j3 Main
......llvm-dis < Main.bc > Main_assembly


For the global variables, I have :
P = ({ i32, i32 }* @MYGL_static, i32 0, i32 1)
balance = ({ i32, i32 }* @MYGL_static, i32 0, i32 0)

Ok, in the bytecode there is no string "P", "balance" etc. I assume they are preserved in internal globals. The most interesting looks:

@17 = internal global [82 x i32] [i32 0, i32 1179694, i32 47, i32 131118, i32 48, i32 131121, i32 3276851, i32 3276852, i32 53, i32 3538999, i32 56, i32 655406, i32 57, i32 655418, i32 524347, i32 655420, i32 3997758, i32 63, i32 64, i32 87, i32 114, i32 118, i32 33, i32 139, i32 148, i32 154, i32 161, i32 179, i32 200, i32 207, i32 216, i32 223, i32 248, i32 257, i32 282, i32 286, i32 292, i32 316, i32 323, i32 345, i32 47, i32 53, i32 367, i32 65, i32 383, i32 396, i32 1507352, i32 413, i32 436, i32 4325443, i32 68, i32 4522004, i32 4587540, i32 466, i32 71, i32 4718665, i32 496, i32 522, i32 4849739, i32 4980813, i32 5111885, i32 79, i32 5242961, i32 581, i32 588, i32 607, i32 629, i32 637, i32 660, i32 667, i32 671, i32 681, i32 700, i32 706, i32 730, i32 739, i32 787, i32 800, i32 823, i32 834, i32 856, i32 866]


I was trying to look into an ASCII table to see if "P", "Q" or "balance" are kept, but I cannot find. Do you know where are kept the references to the variable names?

Thank you for your help !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130625/5371746e/attachment.html>


More information about the llvm-dev mailing list