Mercurial > hg > truffle
comparison src/share/vm/interpreter/templateInterpreter.cpp @ 900:9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
Summary: developed a reexecute logic for the interpreter to reexecute the bytecode when deopt happens
Reviewed-by: kvn, never, jrose, twisti
author | cfang |
---|---|
date | Fri, 31 Jul 2009 17:12:33 -0700 |
parents | be93aad57795 |
children | 389049f3f393 |
comparison
equal
deleted
inserted
replaced
899:55cb84cd1247 | 900:9987d9d5eb0e |
---|---|
603 copy_table((address*)&_normal_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address)); | 603 copy_table((address*)&_normal_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address)); |
604 } | 604 } |
605 } | 605 } |
606 } | 606 } |
607 | 607 |
608 // If deoptimization happens, this method returns the point where to continue in | 608 //------------------------------------------------------------------------------------------------------------------------ |
609 // interpreter. For calls (invokexxxx, newxxxx) the continuation is at next | 609 // Deoptimization support |
610 // bci and the top of stack is in eax/edx/FPU tos. | 610 |
611 // For putfield/getfield, put/getstatic, the continuation is at the same | 611 // If deoptimization happens, this function returns the point of next bytecode to continue execution |
612 // bci and the TOS is on stack. | 612 address TemplateInterpreter::deopt_continue_after_entry(methodOop method, address bcp, int callee_parameters, bool is_top_frame) { |
613 | 613 return AbstractInterpreter::deopt_continue_after_entry(method, bcp, callee_parameters, is_top_frame); |
614 // Note: deopt_entry(type, 0) means reexecute bytecode | 614 } |
615 // deopt_entry(type, length) means continue at next bytecode | 615 |
616 | 616 // If deoptimization happens, this function returns the point where the interpreter reexecutes |
617 address TemplateInterpreter::continuation_for(methodOop method, address bcp, int callee_parameters, bool is_top_frame, bool& use_next_mdp) { | 617 // the bytecode. |
618 // Note: Bytecodes::_athrow (C1 only) and Bytecodes::_return are the special cases | |
619 // that do not return "Interpreter::deopt_entry(vtos, 0)" | |
620 address TemplateInterpreter::deopt_reexecute_entry(methodOop method, address bcp) { | |
618 assert(method->contains(bcp), "just checkin'"); | 621 assert(method->contains(bcp), "just checkin'"); |
619 Bytecodes::Code code = Bytecodes::java_code_at(bcp); | 622 Bytecodes::Code code = Bytecodes::java_code_at(bcp); |
620 if (code == Bytecodes::_return) { | 623 if (code == Bytecodes::_return) { |
621 // This is used for deopt during registration of finalizers | 624 // This is used for deopt during registration of finalizers |
622 // during Object.<init>. We simply need to resume execution at | 625 // during Object.<init>. We simply need to resume execution at |
623 // the standard return vtos bytecode to pop the frame normally. | 626 // the standard return vtos bytecode to pop the frame normally. |
624 // reexecuting the real bytecode would cause double registration | 627 // reexecuting the real bytecode would cause double registration |
625 // of the finalizable object. | 628 // of the finalizable object. |
626 assert(is_top_frame, "must be on top"); | 629 return _normal_table.entry(Bytecodes::_return).entry(vtos); |
627 return _normal_table.entry(Bytecodes::_return).entry(vtos); | |
628 } else { | 630 } else { |
629 return AbstractInterpreter::continuation_for(method, bcp, callee_parameters, is_top_frame, use_next_mdp); | 631 return AbstractInterpreter::deopt_reexecute_entry(method, bcp); |
632 } | |
633 } | |
634 | |
635 // If deoptimization happens, the interpreter should reexecute this bytecode. | |
636 // This function mainly helps the compilers to set up the reexecute bit. | |
637 bool TemplateInterpreter::bytecode_should_reexecute(Bytecodes::Code code) { | |
638 if (code == Bytecodes::_return) { | |
639 //Yes, we consider Bytecodes::_return as a special case of reexecution | |
640 return true; | |
641 } else { | |
642 return AbstractInterpreter::bytecode_should_reexecute(code); | |
630 } | 643 } |
631 } | 644 } |
632 | 645 |
633 #endif // !CC_INTERP | 646 #endif // !CC_INTERP |