Question on TemplateTable::prepare_invoke
Peng Du
imdupeng at gmail.com
Tue Mar 2 21:24:55 PST 2010
Hello,
I have a very specific question about an error I ran into today. I am very
familiar
with assembly programming. So, please bear with me.
If I understand correctly, TemplateTable::prepare_invoke is a helper methods
for
the invokeXXX bytecodes. What I tried to do was to pass the oop of the
method
receiver to InterpreterRuntime::cache_object, which simply caches it in the
current
thread.
Below is an excerpt in templateTable_x86_64.cpp) that I modified, the
cache_object method in interpreterRuntime.cpp, and the cache_object method
in thread.hpp:
===========================================================
void TemplateTable::prepare_invoke(Register, Register, int) {
const Register recv = rcx;
...
// load receiver if needed (note: no return address pushed yet)
if (load_receiver) {
__ movl(recv, flags);
__ andl(recv, 0xFF);
if (TaggedStackInterpreter) __ shll(recv, 1); // index*2
Address recv_addr(rsp, recv, Address::times_8,
-Interpreter::expr_offset_in_bytes(1));
if (is_invokedynamic) {
__ lea(recv, recv_addr);
} else {
__ movptr(recv, recv_addr);
__ verify_oop(recv);
}
// !!! cache receiver object !!!
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
InterpreterRuntime::cache_object), recv);
}
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IRT_ENTRY(void, InterpreterRuntime::cache_object(JavaThread* thread, oop
o))
thread->cache_object(o);
IRT_END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class JavaThread {
...
inline void cache_object(oop o) { _object = o; }
===========================================================
However, this failed even in test_gamma with the following error:
Error occurred during initialization of VM
java.lang.StackOverflowError
at java.lang.NullPointerException.<init>(NullPointerException.java:53)
at java.lang.NullPointerException.<init>(NullPointerException.java:53)
< a long list of NullPointerException same as above ... >
at java.lang.String.<clinit>(String.java:1218)
It appeared to me there is infinite recursive creations of
NullPointerException
somewhere caused by the static initializer in String class. String.java:1218
looks like this:
public static final Comparator<String> CASE_INSENSITIVE_ORDER = new
CaseInsensitiveComparator();
Is it because I somehow clobber the recv (rcx) register? Or can someone tell
me
what I did was wrong and how to fix it? Moreover, is there any documentation
on
the rules that how registers are used in template interpreter?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20100302/9cef9f3b/attachment.html
More information about the hotspot-dev
mailing list