Re: [drlvm][jit] Seems like too many classes loaded
Just to finalize the issue: BEA's runtime also provides compilation info, and it encountered 1081 methods on HelloWorldApp. Startup is really costly :( PS. I'm catching up after a week offline, sorry for resurrecting such an old thread :$ 24 Oct 2006 13:31:16 +0700, Egor Pasko [EMAIL PROTECTED]: On the 0x20B day of Apache Harmony Armand Navabi wrote: I am trying to become more familiar with the jit code. I ran the following to see what all was compiled when running Hello World. java -Xtrace:compile Hello. I was very surprised to see the number of methods that seem to be loaded. I think there are about 1079 methods that get compiled for Hello World. Does harmony just load all the classes in the classlib and compile every method? If not, then why would there be so many methods compiled for a simple hello world program? my 2c: first time methods are compiled just before execution. So, you have to execute a method in your app to see it compiled. Right now I am trying to write a simple profiling tool that counts the number of certain instructions in a program for a given input (i.e. I want to run the program, and for every instruction that ends up running, collect information). So, since it seems that the jit not only compiles every instruction in the program (not only the ones that end up running), but also a bunch of other classes, I thought perhaps I would be more interested in the interpreter. Do you mean bytecode instructions? or CPU instructions? For bytecode you better use the interpreter. For IA-32 we have a special profiling utility in JIT CG (iprof) that allows to count how many instructions of a certain kind were executed, what are the hottest basicblocks, etc. Feel free to ask on iprof in the mailing list. (I think, we should document this :P, but it is not the first priority) Running java -Xint -Xtrace:interpreter Hello then also gave me way more output then I expected. For example ... interpreter: java/lang/String indexOf(II)I interpreter: java/lang/String startsWith(Ljava/lang/String;)Z interpreter: java/lang/String startsWith(Ljava/lang/String;I)Z interpreter: java/lang/String regionMatches(ILjava/lang/String;II)Z interpreter: java/net/URI access$1002(Ljava/net/URI;Ljava/lang/String;)Ljava/lang/String; interpreter: java/net/URI access$1000(Ljava/net/URI;)Ljava/lang/String; interpreter: java/net/URI$Helper validatePath(Ljava/lang/String;Ljava/lang/String;I)V interpreter: java/net/URIEncoderDecoder validate(Ljava/lang/String;Ljava/lang/String;)V interpreter: java/lang/String length()I interpreter: java/lang/String charAt(I)C interpreter: java/lang/String indexOf(I)I interpreter: java/lang/String indexOf(II)I interpreter: java/lang/String length()I ... I'm not sure why all of this is being interpreted for a simple hello world program. My understanding was that the interpreter traverses the byte code for the given input and then handles the executed byte codes. It seems like a lot more is going on here. Also, I am trying to become familiar with the jit and interpreter by reading the DRL Developer's Guide. Are there any other resources other than the Developer's Guide and this mailing list? Thanks Armand -- Egor Pasko, Intel Managed Runtime Division
[drlvm][jit] Seems like too many classes loaded
I am trying to become more familiar with the jit code. I ran the following to see what all was compiled when running Hello World. java -Xtrace:compile Hello. I was very surprised to see the number of methods that seem to be loaded. I think there are about 1079 methods that get compiled for Hello World. Does harmony just load all the classes in the classlib and compile every method? If not, then why would there be so many methods compiled for a simple hello world program? Right now I am trying to write a simple profiling tool that counts the number of certain instructions in a program for a given input (i.e. I want to run the program, and for every instruction that ends up running, collect information). So, since it seems that the jit not only compiles every instruction in the program (not only the ones that end up running), but also a bunch of other classes, I thought perhaps I would be more interested in the interpreter. Running java -Xint -Xtrace:interpreter Hello then also gave me way more output then I expected. For example ... interpreter: java/lang/String indexOf(II)I interpreter: java/lang/String startsWith(Ljava/lang/String;)Z interpreter: java/lang/String startsWith(Ljava/lang/String;I)Z interpreter: java/lang/String regionMatches(ILjava/lang/String;II)Z interpreter: java/net/URI access$1002(Ljava/net/URI;Ljava/lang/String;)Ljava/lang/String; interpreter: java/net/URI access$1000(Ljava/net/URI;)Ljava/lang/String; interpreter: java/net/URI$Helper validatePath(Ljava/lang/String;Ljava/lang/String;I)V interpreter: java/net/URIEncoderDecoder validate(Ljava/lang/String;Ljava/lang/String;)V interpreter: java/lang/String length()I interpreter: java/lang/String charAt(I)C interpreter: java/lang/String indexOf(I)I interpreter: java/lang/String indexOf(II)I interpreter: java/lang/String length()I ... I'm not sure why all of this is being interpreted for a simple hello world program. My understanding was that the interpreter traverses the byte code for the given input and then handles the executed byte codes. It seems like a lot more is going on here. Also, I am trying to become familiar with the jit and interpreter by reading the DRL Developer's Guide. Are there any other resources other than the Developer's Guide and this mailing list? Thanks Armand
Re: [drlvm][jit] Seems like too many classes loaded
Welcome Armand! My comments are inlined. On 10/23/06, Armand Navabi [EMAIL PROTECTED] wrote: I am trying to become more familiar with the jit code. I ran the following to see what all was compiled when running Hello World. java -Xtrace:compile Hello. I was very surprised to see the number of methods that seem to be loaded. I think there are about 1079 methods that get compiled for Hello World. Yes you are right. To run Hello World application ~ 1000 methods are compiled. These methods are from threads, IO, classloading, security, utilities, VM infrastructure classes. 1000 methods is not a big number: the optimizing compiler performance is more than 1000/per second (my 2Ghz PC). The baseline JET compiler is ten times faster. Does harmony just load all the classes in the classlib and compile every method? If not, then why would there be so many methods compiled for a simple hello world program? Not Harmony does not load all the classes. Right now I am trying to write a simple profiling tool that counts the number of certain instructions in a program for a given input (i.e. I want to run the program, and for every instruction that ends up running, collect information). So, since it seems that the jit not only compiles every instruction in the program (not only the ones that end up running), but also a bunch of other classes, I thought perhaps I would be more interested in the interpreter. Interpreter also executes a lot of startup methods before running main. There is a solution how to compile only predefined set of methods by separate JIT compiler. See EM guide for details how to filter methods: http://incubator.apache.org/harmony/subcomponents/drlvm/emguide.html The filters will not work with interpreter. Also, I am trying to become familiar with the jit and interpreter by reading the DRL Developer's Guide. Are there any other resources other than the Developer's Guide and this mailing list? Check these pages too: http://incubator.apache.org/harmony/subcomponents/drlvm/index.html http://wiki.apache.org/harmony/ or ask directly in the mailing list :) -- Mikhail Fursov