comparison src/share/vm/opto/compile.cpp @ 17980:0bf37f737702

8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9 Summary: make compiled code bang the stack by the worst case size of the interpreter frame at deoptimization points. Reviewed-by: twisti, kvn
author roland
date Tue, 01 Apr 2014 09:36:49 +0200
parents 78bbf4d43a14
children 52b4284cb496 411e30e5fbb8
comparison
equal deleted inserted replaced
17978:ad51f24671c2 17980:0bf37f737702
437 int words = _frame_slots >> shift; 437 int words = _frame_slots >> shift;
438 assert( words << shift == _frame_slots, "frame size must be properly aligned in LP64" ); 438 assert( words << shift == _frame_slots, "frame size must be properly aligned in LP64" );
439 return words; 439 return words;
440 } 440 }
441 441
442 // To bang the stack of this compiled method we use the stack size
443 // that the interpreter would need in case of a deoptimization. This
444 // removes the need to bang the stack in the deoptimization blob which
445 // in turn simplifies stack overflow handling.
446 int Compile::bang_size_in_bytes() const {
447 return MAX2(_interpreter_frame_size, frame_size_in_bytes());
448 }
449
442 // ============================================================================ 450 // ============================================================================
443 //------------------------------CompileWrapper--------------------------------- 451 //------------------------------CompileWrapper---------------------------------
444 class CompileWrapper : public StackObj { 452 class CompileWrapper : public StackObj {
445 Compile *const _compile; 453 Compile *const _compile;
446 public: 454 public:
660 _number_of_mh_late_inlines(0), 668 _number_of_mh_late_inlines(0),
661 _inlining_progress(false), 669 _inlining_progress(false),
662 _inlining_incrementally(false), 670 _inlining_incrementally(false),
663 _print_inlining_list(NULL), 671 _print_inlining_list(NULL),
664 _print_inlining_idx(0), 672 _print_inlining_idx(0),
665 _preserve_jvm_state(0) { 673 _preserve_jvm_state(0),
674 _interpreter_frame_size(0) {
666 C = this; 675 C = this;
667 676
668 CompileWrapper cw(this); 677 CompileWrapper cw(this);
669 #ifndef PRODUCT 678 #ifndef PRODUCT
670 if (TimeCompiler2) { 679 if (TimeCompiler2) {
967 _inlining_progress(false), 976 _inlining_progress(false),
968 _inlining_incrementally(false), 977 _inlining_incrementally(false),
969 _print_inlining_list(NULL), 978 _print_inlining_list(NULL),
970 _print_inlining_idx(0), 979 _print_inlining_idx(0),
971 _preserve_jvm_state(0), 980 _preserve_jvm_state(0),
972 _allowed_reasons(0) { 981 _allowed_reasons(0),
982 _interpreter_frame_size(0) {
973 C = this; 983 C = this;
974 984
975 #ifndef PRODUCT 985 #ifndef PRODUCT
976 TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false); 986 TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false);
977 TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false); 987 TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false);
3076 if (i < cnt) { 3086 if (i < cnt) {
3077 // Place all non-visited non-null inputs onto stack 3087 // Place all non-visited non-null inputs onto stack
3078 Node* m = n->in(i); 3088 Node* m = n->in(i);
3079 ++i; 3089 ++i;
3080 if (m != NULL && !frc._visited.test_set(m->_idx)) { 3090 if (m != NULL && !frc._visited.test_set(m->_idx)) {
3081 if (m->is_SafePoint() && m->as_SafePoint()->jvms() != NULL) 3091 if (m->is_SafePoint() && m->as_SafePoint()->jvms() != NULL) {
3092 // compute worst case interpreter size in case of a deoptimization
3093 update_interpreter_frame_size(m->as_SafePoint()->jvms()->interpreter_frame_size());
3094
3082 sfpt.push(m); 3095 sfpt.push(m);
3096 }
3083 cnt = m->req(); 3097 cnt = m->req();
3084 nstack.push(n, i); // put on stack parent and next input's index 3098 nstack.push(n, i); // put on stack parent and next input's index
3085 n = m; 3099 n = m;
3086 i = 0; 3100 i = 0;
3087 } 3101 }