From: Robin G. <rob...@an...> - 2009-01-16 04:01:31
|
Xinwei, You are asking several questions here. The one I'm answering is this: > I want to know which thread execute "invokespecial" bytecode currently, how can I know that? As far as I understand your question, what you're asking is: "If you look at the system at a certain instant (eg via a timer), which threads are currently executing an invokespecial bytecode at some point in their call stack". As far as I can see, what you need to do to answer this question is: - Halt all the threads - Work through the stack of each thread, looking for invokespecial bytecodes currently in flight if you apply what I said below at this point, then the problem is solved. Regards, Robin Xinwei Xie wrote: > Hi Robin, > Thanks for reply. > What I mean is specified to another poster. Please check it out ;-) > http://www.nabble.com/-rvm-research--Can-someone-explain-it-to-me--tt21490704.html > > Regards, > Xinwei > > > Robin Garner wrote: > >> Hi Xinwei, >> >> So do you mean that you want to be able to freeze the system, examine >> all executing threads, and identify which ones are currently executing >> an 'invokespecial' ? >> >> If you examine the method >> >> org.jikesrvm.scheduler.Scheduler#dumpStack(Address ip, Address fp) >> >> take a look at the code starting at line 743, >> // normal java frame(s) >> CompiledMethod compiledMethod = >> CompiledMethods.getCompiledMethod(compiledMethodId); >> if (compiledMethod == null) { >> showMethod(compiledMethodId, fp); >> } else if (compiledMethod.getCompilerType() == CompiledMethod.TRAP) { >> showMethod("hardware trap", fp); >> } else { >> RVMMethod method = compiledMethod.getMethod(); >> Offset instructionOffset = compiledMethod.getInstructionOffset(ip, >> false); >> int lineNumber = >> compiledMethod.findLineNumberForInstruction(instructionOffset); >> >> you can see how to locate the instruction from the call stack. >> >> If you look at the findLineNumberForInstruction method of a >> CompiledMethod, you should see how you could write a method that would >> return the bytecode for the instruction rather than the line number. >> >> cheers, >> Robin >> >> Xinwei Xie wrote: >> >>> Hi Steve, >>> >>> Thanks for your kind reply. :-) >>> >>> I've checked out the bootstrap process. What I mean is when eveything is >>> ready, i.e., the virtual machine machine is fully booted, is the compiler >>> going to compile every bytecode into native code and execute them? My >>> question is where can it be started? Is there some entry point in >>> JikesRVM >>> that can execute the code? e.g., I want to know which thread execute >>> "invokespecial" bytecode currently, how can I know that? Hopefully I >>> explain >>> it clearly. >>> >>> Regards, >>> Xinwei >>> >>> Steve Blackburn wrote: >>> >>> >>>> On 15/01/2009, at 3:33 PM, Xinwei Xie wrote: >>>> >>>> >>>>> You mean jikesrvm will execute native codes. >>>>> >>>>> >>>> No. Eliot meant that Jikes RVM will execute bytecode "natively". >>>> >>>> "Native code" usually refers to C code etc. Jikes RVM, can of course >>>> do that too. But Eliot was pointing out that bytecodes are not >>>> interpreted, but rather, they are compiled to machine code which is >>>> then executed directly (not interpreted). >>>> >>>> >>>> >>>>> However, where is the execution >>>>> entrypoint? I am always trying to find it out. ;-) >>>>> >>>>> >>>> Do you mean how is the JVM bootstrapped? >>>> >>>> It starts with a small piece of C & asm, which you can look at in >>>> tools/bootImageRunner/ia32/libVM.c and the createVM() function. >>>> Among other things, this mmaps the boot iamge and throws execution to >>>> code that you can find in org.jikesrvm.VM.java >>>> >>>> Cheers, >>>> >>>> --Steve >>>> >>>> ------------------------------------------------------------------------------ >>>> This SF.net email is sponsored by: >>>> SourcForge Community >>>> SourceForge wants to tell your story. >>>> http://p.sf.net/sfu/sf-spreadtheword >>>> _______________________________________________ >>>> Jikesrvm-researchers mailing list >>>> Jik...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers >>>> >>>> >>>> >>>> >>> ----- >>> Xinwei Xie >>> School of Computer Science and Engineering >>> University of New South Wales >>> Sydney, Australia >>> >>> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Jikesrvm-researchers mailing list >> Jik...@li... >> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers >> >> >> > > > ----- > Xinwei Xie > School of Computer Science and Engineering > University of New South Wales > Sydney, Australia > |