comparison src/share/vm/interpreter/bytecodeInterpreter.cpp @ 10393:603ca7e51354

8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292 Summary: ConstMethod::max_stack() doesn't account for JSR 292 appendix. Reviewed-by: kvn
author roland
date Wed, 24 Apr 2013 11:49:38 +0200
parents e60b3fce2b02
children 6a0ead6dc6db 48d3d0eb193b
comparison
equal deleted inserted replaced
10392:c07dd9be16e8 10393:603ca7e51354
466 466
467 static int _compiling; // (UseCompiler || CountCompiledCalls) 467 static int _compiling; // (UseCompiler || CountCompiledCalls)
468 468
469 #ifdef ASSERT 469 #ifdef ASSERT
470 if (istate->_msg != initialize) { 470 if (istate->_msg != initialize) {
471 assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit"); 471 // We have a problem here if we are running with a pre-hsx24 JDK (for example during bootstrap)
472 // because in that case, EnableInvokeDynamic is true by default but will be later switched off
473 // if java_lang_invoke_MethodHandle::compute_offsets() detects that the JDK only has the classes
474 // for the old JSR292 implementation.
475 // This leads to a situation where 'istate->_stack_limit' always accounts for
476 // methodOopDesc::extra_stack_entries() because it is computed in
477 // CppInterpreterGenerator::generate_compute_interpreter_state() which was generated while
478 // EnableInvokeDynamic was still true. On the other hand, istate->_method->max_stack() doesn't
479 // account for extra_stack_entries() anymore because at the time when it is called
480 // EnableInvokeDynamic was already set to false.
481 // So we have a second version of the assertion which handles the case where EnableInvokeDynamic was
482 // switched off because of the wrong classes.
483 if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) {
484 assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
485 } else {
486 const int extra_stack_entries = Method::extra_stack_entries_for_indy;
487 assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries
488 + 1), "bad stack limit");
489 }
472 #ifndef SHARK 490 #ifndef SHARK
473 IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong")); 491 IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong"));
474 #endif // !SHARK 492 #endif // !SHARK
475 } 493 }
476 // Verify linkages. 494 // Verify linkages.