comparison src/share/vm/oops/methodOop.hpp @ 6266:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents dd785aabe02b
children 93c71eb28866
comparison
equal deleted inserted replaced
6241:aba91a731143 6266:1d7922586cf6
122 u2 _max_locals; // Number of local variables used by this method 122 u2 _max_locals; // Number of local variables used by this method
123 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words 123 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
124 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) 124 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
125 u1 _jfr_towrite : 1, // Flags 125 u1 _jfr_towrite : 1, // Flags
126 _force_inline : 1, 126 _force_inline : 1,
127 : 6; 127 _hidden : 1,
128 _dont_inline : 1,
129 : 4;
128 u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting 130 u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
129 u2 _number_of_breakpoints; // fullspeed debugging support 131 u2 _number_of_breakpoints; // fullspeed debugging support
130 InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations 132 InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
131 InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations 133 InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations
132 134
243 // constant pool for klassOop holding this method 245 // constant pool for klassOop holding this method
244 constantPoolOop constants() const { return constMethod()->constants(); } 246 constantPoolOop constants() const { return constMethod()->constants(); }
245 void set_constants(constantPoolOop c) { constMethod()->set_constants(c); } 247 void set_constants(constantPoolOop c) { constMethod()->set_constants(c); }
246 248
247 // max stack 249 // max stack
248 int max_stack() const { return _max_stack; } 250 int max_stack() const { return _max_stack + extra_stack_entries(); }
249 void set_max_stack(int size) { _max_stack = size; } 251 void set_max_stack(int size) { _max_stack = size; }
250 252
251 // max locals 253 // max locals
252 int max_locals() const { return _max_locals; } 254 int max_locals() const { return _max_locals; }
253 void set_max_locals(int size) { _max_locals = size; } 255 void set_max_locals(int size) { _max_locals = size; }
588 590
589 // Reflection support 591 // Reflection support
590 bool is_overridden_in(klassOop k) const; 592 bool is_overridden_in(klassOop k) const;
591 593
592 // JSR 292 support 594 // JSR 292 support
593 bool is_method_handle_invoke() const { return access_flags().is_method_handle_invoke(); } 595 bool is_method_handle_intrinsic() const; // MethodHandles::is_signature_polymorphic_intrinsic(intrinsic_id)
594 static bool is_method_handle_invoke_name(vmSymbols::SID name_sid); 596 bool is_compiled_lambda_form() const; // intrinsic_id() == vmIntrinsics::_compiledLambdaForm
595 static bool is_method_handle_invoke_name(Symbol* name) { 597 bool has_member_arg() const; // intrinsic_id() == vmIntrinsics::_linkToSpecial, etc.
596 return is_method_handle_invoke_name(vmSymbols::find_sid(name)); 598 static methodHandle make_method_handle_intrinsic(vmIntrinsics::ID iid, // _invokeBasic, _linkToVirtual
597 } 599 Symbol* signature, //anything at all
598 // Tests if this method is an internal adapter frame from the 600 TRAPS);
599 // MethodHandleCompiler.
600 bool is_method_handle_adapter() const;
601 static methodHandle make_invoke_method(KlassHandle holder,
602 Symbol* name, //invokeExact or invokeGeneric
603 Symbol* signature, //anything at all
604 Handle method_type,
605 TRAPS);
606 static klassOop check_non_bcp_klass(klassOop klass); 601 static klassOop check_non_bcp_klass(klassOop klass);
607 // these operate only on invoke methods: 602 // these operate only on invoke methods:
608 oop method_handle_type() const;
609 static jint* method_type_offsets_chain(); // series of pointer-offsets, terminated by -1
610 // presize interpreter frames for extra interpreter stack entries, if needed 603 // presize interpreter frames for extra interpreter stack entries, if needed
611 // method handles want to be able to push a few extra values (e.g., a bound receiver), and 604 // method handles want to be able to push a few extra values (e.g., a bound receiver), and
612 // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist, 605 // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist,
613 // all without checking for a stack overflow 606 // all without checking for a stack overflow
614 static int extra_stack_entries() { return EnableInvokeDynamic ? (int) MethodHandlePushLimit + 3 : 0; } 607 static int extra_stack_entries() { return EnableInvokeDynamic ? 2 : 0; }
615 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize() 608 static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize()
616 609
617 // RedefineClasses() support: 610 // RedefineClasses() support:
618 bool is_old() const { return access_flags().is_old(); } 611 bool is_old() const { return access_flags().is_old(); }
619 void set_is_old() { _access_flags.set_is_old(); } 612 void set_is_old() { _access_flags.set_is_old(); }
654 static vmSymbols::SID klass_id_for_intrinsics(klassOop holder); 647 static vmSymbols::SID klass_id_for_intrinsics(klassOop holder);
655 648
656 bool jfr_towrite() { return _jfr_towrite; } 649 bool jfr_towrite() { return _jfr_towrite; }
657 void set_jfr_towrite(bool towrite) { _jfr_towrite = towrite; } 650 void set_jfr_towrite(bool towrite) { _jfr_towrite = towrite; }
658 651
659 bool force_inline() { return _force_inline; } 652 bool force_inline() { return _force_inline; }
660 void set_force_inline(bool fi) { _force_inline = fi; } 653 void set_force_inline(bool x) { _force_inline = x; }
654 bool dont_inline() { return _dont_inline; }
655 void set_dont_inline(bool x) { _dont_inline = x; }
656 bool is_hidden() { return _hidden; }
657 void set_hidden(bool x) { _hidden = x; }
661 658
662 // On-stack replacement support 659 // On-stack replacement support
663 bool has_osr_nmethod(int level, bool match_level) { 660 bool has_osr_nmethod(int level, bool match_level) {
664 return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; 661 return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
665 } 662 }
702 699
703 // Return if true if not all classes references in signature, including return type, has been loaded 700 // Return if true if not all classes references in signature, including return type, has been loaded
704 static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS); 701 static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS);
705 702
706 // Printing 703 // Printing
707 void print_short_name(outputStream* st) /*PRODUCT_RETURN*/; // prints as klassname::methodname; Exposed so field engineers can debug VM 704 void print_short_name(outputStream* st = tty) /*PRODUCT_RETURN*/; // prints as klassname::methodname; Exposed so field engineers can debug VM
708 void print_name(outputStream* st) PRODUCT_RETURN; // prints as "virtual void foo(int)" 705 void print_name(outputStream* st = tty) PRODUCT_RETURN; // prints as "virtual void foo(int)"
709 706
710 // Helper routine used for method sorting 707 // Helper routine used for method sorting
711 static void sort_methods(objArrayOop methods, 708 static void sort_methods(objArrayOop methods,
712 objArrayOop methods_annotations, 709 objArrayOop methods_annotations,
713 objArrayOop methods_parameter_annotations, 710 objArrayOop methods_parameter_annotations,