Alexandru Ionut Diaconescu
2013-Jun-25 15:58 UTC
[LLVMdev] vmkit variables internal representation
Hi Tim, Thank you for your answer. Tomorrow morning I will update my question after further investigation based on your advice and with the .ll. ________________________________ From: Tim Northover <t.p.northover at gmail.com> To: Alexandru Ionut Diaconescu <cyrusthevirus001x at yahoo.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, June 25, 2013 5:50 PM Subject: Re: [LLVMdev] vmkit variables internal representation Hi Alexandru,> 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?You've probably got to convince the compiler not to optimise since eliminating those variables is probably one of the simpler things that goes on during optimisation. I'd expect the unoptimised code to have "alloca" instructions inside the function which represent those variables. I'm afraid I don't know the javac command-line option to do that though. Your questions may be better answered on a Java list dealing with that compiler.> Ok, in the bytecode there is no string "P", "balance" etc. I assume they are > preserved in internal globals.Could be. Doesn't java use UTF-16 for its strings? If so, I'd be looking for arrays of i16 for my names. Assuming they're there at all, of course (depends on Java API, ABI and possibly optimisations LLVM was able to perform). If you post a full .ll file we may be able to say more. Or someone may be along who knows the Java LLVM compiler off the top of their head. Cheers. Tim. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130625/bcea779d/attachment.html>
Alexandru Ionut Diaconescu
2013-Jun-26 13:04 UTC
[LLVMdev] vmkit variables internal representation
Hello Tim, I attached the assembly file, the java file and the running script file. I hope the variable names can be identified. Thanks ________________________________ From: Alexandru Ionut Diaconescu <cyrusthevirus001x at yahoo.com> To: Tim Northover <t.p.northover at gmail.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, June 25, 2013 5:58 PM Subject: Re: [LLVMdev] vmkit variables internal representation Hi Tim, Thank you for your answer. Tomorrow morning I will update my question after further investigation based on your advice and with the .ll. ________________________________ From: Tim Northover <t.p.northover at gmail.com> To: Alexandru Ionut Diaconescu <cyrusthevirus001x at yahoo.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, June 25, 2013 5:50 PM Subject: Re: [LLVMdev] vmkit variables internal representation Hi Alexandru,> 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?You've probably got to convince the compiler not to optimise since eliminating those variables is probably one of the simpler things that goes on during optimisation. I'd expect the unoptimised code to have "alloca" instructions inside the function which represent those variables. I'm afraid I don't know the javac command-line option to do that though. Your questions may be better answered on a Java list dealing with that compiler.> Ok, in the bytecode there is no string "P", "balance" etc. I assume they are >preserved in internal globals. Could be. Doesn't java use UTF-16 for its strings? If so, I'd be looking for arrays of i16 for my names. Assuming they're there at all, of course (depends on Java API, ABI and possibly optimisations LLVM was able to perform). If you post a full .ll file we may be able to say more. Or someone may be along who knows the Java LLVM compiler off the top of their head. Cheers. Tim. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/eced6551/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: Main.bc Type: application/octet-stream Size: 12160 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/eced6551/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: Main.java Type: text/x-java Size: 1943 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/eced6551/attachment.java> -------------- next part -------------- A non-text attachment was scrubbed... Name: Main_assembly Type: application/octet-stream Size: 58318 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/eced6551/attachment-0001.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: run.sh Type: application/x-sh Size: 516 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/eced6551/attachment.sh>
> I attached the assembly file, the java file and the running script file. I > hope the variable names can be identified.Well, I'm afraid I know no more about the Java ABI than you, but Java strings can be identified by the type {i32, [N x i16]} where the first entry is the length and the array is UTF-16. Running the attached hacked-together script on your bitcode file gives the following: @41 contains string "MYGL" @42 contains string "P" @43 contains string "balance" How these fit into the structures defined used is left as an exercise to the interested reader. ;-) Tim. -------------- next part -------------- A non-text attachment was scrubbed... Name: tmp.py Type: application/octet-stream Size: 672 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/d1a8c638/attachment.obj>