src/share/vm/oops/method.hpp

Print this page
rev 4269 : 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:


 256   // note: also used by jfr
 257   u2 method_idnum() const           { return constMethod()->method_idnum(); }
 258   void set_method_idnum(u2 idnum)   { constMethod()->set_method_idnum(idnum); }
 259 
 260   // code size
 261   int code_size() const                  { return constMethod()->code_size(); }
 262 
 263   // method size
 264   int method_size() const                        { return _method_size; }
 265   void set_method_size(int size) {
 266     assert(0 <= size && size < (1 << 16), "invalid method size");
 267     _method_size = size;
 268   }
 269 
 270   // constant pool for Klass* holding this method
 271   ConstantPool* constants() const              { return constMethod()->constants(); }
 272   void set_constants(ConstantPool* c)          { constMethod()->set_constants(c); }
 273 
 274   // max stack
 275   // return original max stack size for method verification
 276   int  verifier_max_stack() const                { return constMethod()->max_stack(); }
 277   int           max_stack() const                { return constMethod()->max_stack() + extra_stack_entries(); }
 278   void      set_max_stack(int size)              {        constMethod()->set_max_stack(size); }
 279 
 280   // max locals
 281   int  max_locals() const                        { return constMethod()->max_locals(); }
 282   void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
 283 
 284   int highest_comp_level() const;
 285   void set_highest_comp_level(int level);
 286   int highest_osr_comp_level() const;
 287   void set_highest_osr_comp_level(int level);
 288 
 289   // Count of times method was exited via exception while interpreting
 290   void interpreter_throwout_increment() {
 291     if (_interpreter_throwout_count < 65534) {
 292       _interpreter_throwout_count++;
 293     }
 294   }
 295 
 296   int  interpreter_throwout_count() const        { return _interpreter_throwout_count; }
 297   void set_interpreter_throwout_count(int count) { _interpreter_throwout_count = count; }
 298 


 611   address bcp_from(int     bci) const;
 612   int validate_bci_from_bcx(intptr_t bcx) const;
 613 
 614   // Returns the line number for a bci if debugging information for the method is prowided,
 615   // -1 is returned otherwise.
 616   int line_number_from_bci(int bci) const;
 617 
 618   // Reflection support
 619   bool is_overridden_in(Klass* k) const;
 620 
 621   // JSR 292 support
 622   bool is_method_handle_intrinsic() const;          // MethodHandles::is_signature_polymorphic_intrinsic(intrinsic_id)
 623   bool is_compiled_lambda_form() const;             // intrinsic_id() == vmIntrinsics::_compiledLambdaForm
 624   bool has_member_arg() const;                      // intrinsic_id() == vmIntrinsics::_linkToSpecial, etc.
 625   static methodHandle make_method_handle_intrinsic(vmIntrinsics::ID iid, // _invokeBasic, _linkToVirtual
 626                                                    Symbol* signature, //anything at all
 627                                                    TRAPS);
 628   static Klass* check_non_bcp_klass(Klass* klass);
 629   // these operate only on invoke methods:
 630   // presize interpreter frames for extra interpreter stack entries, if needed
 631   // method handles want to be able to push a few extra values (e.g., a bound receiver), and
 632   // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist,
 633   // all without checking for a stack overflow
 634   static int extra_stack_entries() { return EnableInvokeDynamic ? 2 : 0; }
 635   static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize()
 636 
 637   // RedefineClasses() support:
 638   bool is_old() const                               { return access_flags().is_old(); }
 639   void set_is_old()                                 { _access_flags.set_is_old(); }
 640   bool is_obsolete() const                          { return access_flags().is_obsolete(); }
 641   void set_is_obsolete()                            { _access_flags.set_is_obsolete(); }
 642   bool on_stack() const                             { return access_flags().on_stack(); }
 643   void set_on_stack(const bool value);
 644 
 645   // see the definition in Method*.cpp for the gory details
 646   bool should_not_be_cached() const;
 647 
 648   // JVMTI Native method prefixing support:
 649   bool is_prefixed_native() const                   { return access_flags().is_prefixed_native(); }
 650   void set_is_prefixed_native()                     { _access_flags.set_is_prefixed_native(); }
 651 
 652   // Rewriting support
 653   static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
 654                                           u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);




 256   // note: also used by jfr
 257   u2 method_idnum() const           { return constMethod()->method_idnum(); }
 258   void set_method_idnum(u2 idnum)   { constMethod()->set_method_idnum(idnum); }
 259 
 260   // code size
 261   int code_size() const                  { return constMethod()->code_size(); }
 262 
 263   // method size
 264   int method_size() const                        { return _method_size; }
 265   void set_method_size(int size) {
 266     assert(0 <= size && size < (1 << 16), "invalid method size");
 267     _method_size = size;
 268   }
 269 
 270   // constant pool for Klass* holding this method
 271   ConstantPool* constants() const              { return constMethod()->constants(); }
 272   void set_constants(ConstantPool* c)          { constMethod()->set_constants(c); }
 273 
 274   // max stack
 275   // return original max stack size for method verification
 276   int  verifier_max_stack() const                { return constMethod()->max_stack() - extra_stack_entries(); }
 277   int           max_stack() const                { return constMethod()->max_stack(); }
 278   void      set_max_stack(int size)              {        constMethod()->set_max_stack(size + extra_stack_entries()); }
 279 
 280   // max locals
 281   int  max_locals() const                        { return constMethod()->max_locals(); }
 282   void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
 283 
 284   int highest_comp_level() const;
 285   void set_highest_comp_level(int level);
 286   int highest_osr_comp_level() const;
 287   void set_highest_osr_comp_level(int level);
 288 
 289   // Count of times method was exited via exception while interpreting
 290   void interpreter_throwout_increment() {
 291     if (_interpreter_throwout_count < 65534) {
 292       _interpreter_throwout_count++;
 293     }
 294   }
 295 
 296   int  interpreter_throwout_count() const        { return _interpreter_throwout_count; }
 297   void set_interpreter_throwout_count(int count) { _interpreter_throwout_count = count; }
 298 


 611   address bcp_from(int     bci) const;
 612   int validate_bci_from_bcx(intptr_t bcx) const;
 613 
 614   // Returns the line number for a bci if debugging information for the method is prowided,
 615   // -1 is returned otherwise.
 616   int line_number_from_bci(int bci) const;
 617 
 618   // Reflection support
 619   bool is_overridden_in(Klass* k) const;
 620 
 621   // JSR 292 support
 622   bool is_method_handle_intrinsic() const;          // MethodHandles::is_signature_polymorphic_intrinsic(intrinsic_id)
 623   bool is_compiled_lambda_form() const;             // intrinsic_id() == vmIntrinsics::_compiledLambdaForm
 624   bool has_member_arg() const;                      // intrinsic_id() == vmIntrinsics::_linkToSpecial, etc.
 625   static methodHandle make_method_handle_intrinsic(vmIntrinsics::ID iid, // _invokeBasic, _linkToVirtual
 626                                                    Symbol* signature, //anything at all
 627                                                    TRAPS);
 628   static Klass* check_non_bcp_klass(Klass* klass);
 629   // these operate only on invoke methods:
 630   // presize interpreter frames for extra interpreter stack entries, if needed
 631   // Account for the extra appendix argument for invokehandle/invokedynamic
 632   static int extra_stack_entries() { return EnableInvokeDynamic ? 1 : 0; }


 633   static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize()
 634 
 635   // RedefineClasses() support:
 636   bool is_old() const                               { return access_flags().is_old(); }
 637   void set_is_old()                                 { _access_flags.set_is_old(); }
 638   bool is_obsolete() const                          { return access_flags().is_obsolete(); }
 639   void set_is_obsolete()                            { _access_flags.set_is_obsolete(); }
 640   bool on_stack() const                             { return access_flags().on_stack(); }
 641   void set_on_stack(const bool value);
 642 
 643   // see the definition in Method*.cpp for the gory details
 644   bool should_not_be_cached() const;
 645 
 646   // JVMTI Native method prefixing support:
 647   bool is_prefixed_native() const                   { return access_flags().is_prefixed_native(); }
 648   void set_is_prefixed_native()                     { _access_flags.set_is_prefixed_native(); }
 649 
 650   // Rewriting support
 651   static methodHandle clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length,
 652                                           u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS);