How to retrieve the receiver object of method call
Peng Du
imdupeng at gmail.com
Wed Apr 7 00:02:48 PDT 2010
Hello,
What is the right way to get the receiver object of a Java method call in
the
VM code, considering both the caller, callee can either be interpreted or
compiled?
I tried using the "frame" class and it does have many methods for querying
an interpreted frame, e.g. interpreter_callee_receiver(). But not for
compiled
frame.
By learning related code in SharedRuntime, I wrote the following method. It
works for some calls but fails for the others. Can someone point out what
I have done wrong with the code?
Thanks!
================
static oop retrieve_receiver(JavaThread *thread) {
HandleMark rm(Thread::current());
frame stub = thread->last_frame();
if (!stub.is_java_frame())
stub = stub.java_sender();
RegisterMap reg_map(thread);
frame caller = stub.sender(®_map);
if (caller.is_compiled_frame()) {
return caller.retrieve_receiver(®_map);
}
else { // interpreted
methodOop method;
if (stub.is_compiled_frame())
method = thread->callee_target(); // i2c will set this?
else
method = stub.interpreter_frame_method();
return caller.interpreter_callee_receiver(method->signature());
}
}
- Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20100407/0c848267/attachment.html
More information about the hotspot-dev
mailing list