Re: JVM Interpreter
Thanks you guys. I will try not to run junk into channel and you guys promise to stay well run. Ok. Get Outlook for Android<https://aka.ms/ghei36> From: Kim Barrett Sent: Saturday, August 25, 2018 11:47:41 PM To: mr rupplin Cc: core-libs-dev@openjdk.java.net Subject: Re: JVM Interpreter > On Aug 25, 2018, at 2:39 PM, mr rupplin wrote: > > I am presuming the JVM interpreter is defined/implemented in the the hotspot > module since this is a JVM implementation. This is probably more of a hotspot-dev or hotspot-runtime-dev kind of question, rather than core-libs. > I cannot seem to find *any* instruction in it that gets called by a simple > "./java -ea Class" call. We are stumped. > > > For instance there are methods for local set and reference: > > > void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int > offset) { > >*((address *)&tos[Interpreter::expr_index_at(-offset)]) = value; > } > > void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int > offset) { > > *((oop *)&tos[Interpreter::expr_index_at(-offset)]) = value; > } > > These (and similar in same file) are not being called at all during the JVM > interpreter phase (simple java program as reference). My program creates an > object and calls a test method with a single object as reference. > > What could be the hang up? No printf statement seems to work. I think BytecodeInterpreter is part of CppInterpreter, which I think is only used by Zero platforms, with the TemplateInterpreter used by all other platforms. So unless you are running on a platform that uses Zero, or specifically built for Zero, I think BytecodeInterpreter won't be used (and might not even be compiled in?). > Thanks. > > Max Rupplin > > Software Engineer
Re: JVM Interpreter
On 08/25/2018 07:39 PM, mr rupplin wrote: > I am presuming the JVM interpreter is defined/implemented in the the > hotspot module since this is a JVM implementation. That's right. > I cannot seem to find *any* instruction in it that gets called by a > simple "./java -ea Class" call. We are stumped. On the "teach a man to fish" priniple, here goes. On most systems the interpreter is written in assembly language and generated at runtime. Put a GDB breakpoint here in javaCalls.cpp:: StubRoutines::call_stub()( (address)&link, // (intptr_t*)&(result->_value), // see NOTE above (compiler problem) result_val_address, // see NOTE above (compiler problem) result_type, method(), entry_point, args->parameters(), args->size_of_parameters(), CHECK ); Step in from the call stub. You'll need to use "si" rather than "step", because this is not C++, it's pure hand-crafted assembly language: the real thing. You'll see the registers saved, the parameters copied into the interpreter stack, and the interpreter entered. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
Re: JVM Interpreter
> On Aug 25, 2018, at 2:39 PM, mr rupplin wrote: > > I am presuming the JVM interpreter is defined/implemented in the the hotspot > module since this is a JVM implementation. This is probably more of a hotspot-dev or hotspot-runtime-dev kind of question, rather than core-libs. > I cannot seem to find *any* instruction in it that gets called by a simple > "./java -ea Class" call. We are stumped. > > > For instance there are methods for local set and reference: > > > void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int > offset) { > >*((address *)&tos[Interpreter::expr_index_at(-offset)]) = value; > } > > void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int > offset) { > > *((oop *)&tos[Interpreter::expr_index_at(-offset)]) = value; > } > > These (and similar in same file) are not being called at all during the JVM > interpreter phase (simple java program as reference). My program creates an > object and calls a test method with a single object as reference. > > What could be the hang up? No printf statement seems to work. I think BytecodeInterpreter is part of CppInterpreter, which I think is only used by Zero platforms, with the TemplateInterpreter used by all other platforms. So unless you are running on a platform that uses Zero, or specifically built for Zero, I think BytecodeInterpreter won't be used (and might not even be compiled in?). > Thanks. > > Max Rupplin > > Software Engineer
JVM Interpreter
I am presuming the JVM interpreter is defined/implemented in the the hotspot module since this is a JVM implementation. I cannot seem to find *any* instruction in it that gets called by a simple "./java -ea Class" call. We are stumped. For instance there are methods for local set and reference: void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int offset) { *((address *)&tos[Interpreter::expr_index_at(-offset)]) = value; } void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int offset) { *((oop *)&tos[Interpreter::expr_index_at(-offset)]) = value; } These (and similar in same file) are not being called at all during the JVM interpreter phase (simple java program as reference). My program creates an object and calls a test method with a single object as reference. What could be the hang up? No printf statement seems to work. Thanks. Max Rupplin Software Engineer