--- a/hotspot/src/share/vm/opto/graphKit.cpp Mon Jul 23 13:04:59 2012 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Tue Jul 24 10:51:00 2012 -0700
@@ -965,7 +965,7 @@
assert(call->jvms()->debug_depth() == call->req() - non_debug_edges, "");
}
-bool GraphKit::compute_stack_effects(int& inputs, int& depth) {
+bool GraphKit::compute_stack_effects(int& inputs, int& depth, bool for_parse) {
Bytecodes::Code code = java_bc();
if (code == Bytecodes::_wide) {
code = method()->java_code_at_bci(bci() + 1);
@@ -1032,12 +1032,21 @@
ciBytecodeStream iter(method());
iter.reset_to_bci(bci());
iter.next();
- ciMethod* method = iter.get_method(ignore);
+ ciMethod* callee = iter.get_method(ignore);
// (Do not use ciMethod::arg_size(), because
// it might be an unloaded method, which doesn't
// know whether it is static or not.)
- inputs = method->invoke_arg_size(code);
- int size = method->return_type()->size();
+ if (for_parse) {
+ // Case 1: When called from parse we are *before* the invoke (in the
+ // caller) and need to to adjust the inputs by an appendix
+ // argument that will be pushed implicitly.
+ inputs = callee->invoke_arg_size(code) - (iter.has_appendix() ? 1 : 0);
+ } else {
+ // Case 2: Here we are *after* the invoke (in the callee) and need to
+ // remove any appendix arguments that were popped.
+ inputs = callee->invoke_arg_size(code) - (callee->has_member_arg() ? 1 : 0);
+ }
+ int size = callee->return_type()->size();
depth = size - inputs;
}
break;
@@ -1373,7 +1382,6 @@
}
-
//=============================================================================
//--------------------------------memory---------------------------------------
Node* GraphKit::memory(uint alias_idx) {