src/share/vm/oops/methodOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6839872 Sdiff src/share/vm/oops

src/share/vm/oops/methodOop.cpp

Print this page
rev 2143 : 6839872: remove implementation inheritance from JSR 292 APIs
Summary: Move all JSR 292 classes into the java.dyn package.
Reviewed-by:


 825     return true;
 826   }
 827 
 828   if (mark()->should_not_be_cached()) {
 829     // It is either not safe or not a good idea to cache this
 830     // method at this time because of the state of the embedded
 831     // markOop. See markOop.cpp for the gory details.
 832     return true;
 833   }
 834 
 835   // caching this method should be just fine
 836   return false;
 837 }
 838 
 839 bool methodOopDesc::is_method_handle_invoke_name(vmSymbols::SID name_sid) {
 840   switch (name_sid) {
 841   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
 842   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
 843     return true;
 844   }
 845   if (AllowTransitionalJSR292
 846       && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
 847     return true;
 848   return false;
 849 }
 850 
 851 // Constant pool structure for invoke methods:
 852 enum {
 853   _imcp_invoke_name = 1,        // utf8: 'invokeExact' or 'invokeGeneric'
 854   _imcp_invoke_signature,       // utf8: (variable Symbol*)
 855   _imcp_method_type_value,      // string: (variable java/dyn/MethodType, sic)
 856   _imcp_limit
 857 };
 858 
 859 oop methodOopDesc::method_handle_type() const {
 860   if (!is_method_handle_invoke()) { assert(false, "caller resp."); return NULL; }
 861   oop mt = constants()->resolved_string_at(_imcp_method_type_value);
 862   assert(mt->klass() == SystemDictionary::MethodType_klass(), "");
 863   return mt;
 864 }
 865 


1097     case vmSymbols::VM_SYMBOL_ENUM_NAME(max_name):
1098     case vmSymbols::VM_SYMBOL_ENUM_NAME(sqrt_name):
1099       // pretend it is the corresponding method in the non-strict class:
1100       klass_id = vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_Math);
1101       id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags);
1102       break;
1103     }
1104     break;
1105 
1106   // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
1107   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle):
1108     if (is_static() || !is_native())  break;
1109     switch (name_id) {
1110     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
1111       id = vmIntrinsics::_invokeGeneric;
1112       break;
1113     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
1114       id = vmIntrinsics::_invokeExact;
1115       break;
1116     case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
1117       if (AllowTransitionalJSR292)  id = vmIntrinsics::_invokeExact;

1118       break;
1119     }
1120     break;
1121   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_InvokeDynamic):
1122     if (!is_static() || !is_native())  break;
1123     id = vmIntrinsics::_invokeDynamic;
1124     break;
1125   }
1126 
1127   if (id != vmIntrinsics::_none) {
1128     // Set up its iid.  It is an alias method.
1129     set_intrinsic_id(id);
1130     return;
1131   }
1132 }
1133 
1134 // These two methods are static since a GC may move the methodOopDesc
1135 bool methodOopDesc::load_signature_classes(methodHandle m, TRAPS) {
1136   bool sig_is_loaded = true;
1137   Handle class_loader(THREAD, instanceKlass::cast(m->method_holder())->class_loader());




 825     return true;
 826   }
 827 
 828   if (mark()->should_not_be_cached()) {
 829     // It is either not safe or not a good idea to cache this
 830     // method at this time because of the state of the embedded
 831     // markOop. See markOop.cpp for the gory details.
 832     return true;
 833   }
 834 
 835   // caching this method should be just fine
 836   return false;
 837 }
 838 
 839 bool methodOopDesc::is_method_handle_invoke_name(vmSymbols::SID name_sid) {
 840   switch (name_sid) {
 841   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
 842   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
 843     return true;
 844   }
 845   if ((AllowTransitionalJSR292 || AllowInvokeForInvokeGeneric)
 846       && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
 847     return true;
 848   return false;
 849 }
 850 
 851 // Constant pool structure for invoke methods:
 852 enum {
 853   _imcp_invoke_name = 1,        // utf8: 'invokeExact' or 'invokeGeneric'
 854   _imcp_invoke_signature,       // utf8: (variable Symbol*)
 855   _imcp_method_type_value,      // string: (variable java/dyn/MethodType, sic)
 856   _imcp_limit
 857 };
 858 
 859 oop methodOopDesc::method_handle_type() const {
 860   if (!is_method_handle_invoke()) { assert(false, "caller resp."); return NULL; }
 861   oop mt = constants()->resolved_string_at(_imcp_method_type_value);
 862   assert(mt->klass() == SystemDictionary::MethodType_klass(), "");
 863   return mt;
 864 }
 865 


1097     case vmSymbols::VM_SYMBOL_ENUM_NAME(max_name):
1098     case vmSymbols::VM_SYMBOL_ENUM_NAME(sqrt_name):
1099       // pretend it is the corresponding method in the non-strict class:
1100       klass_id = vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_Math);
1101       id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags);
1102       break;
1103     }
1104     break;
1105 
1106   // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
1107   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle):
1108     if (is_static() || !is_native())  break;
1109     switch (name_id) {
1110     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
1111       id = vmIntrinsics::_invokeGeneric;
1112       break;
1113     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
1114       id = vmIntrinsics::_invokeExact;
1115       break;
1116     case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
1117       if (AllowInvokeForInvokeGeneric)   id = vmIntrinsics::_invokeGeneric;
1118       else if (AllowTransitionalJSR292)  id = vmIntrinsics::_invokeExact;
1119       break;
1120     }
1121     break;
1122   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_InvokeDynamic):
1123     if (!is_static() || !is_native())  break;
1124     id = vmIntrinsics::_invokeDynamic;
1125     break;
1126   }
1127 
1128   if (id != vmIntrinsics::_none) {
1129     // Set up its iid.  It is an alias method.
1130     set_intrinsic_id(id);
1131     return;
1132   }
1133 }
1134 
1135 // These two methods are static since a GC may move the methodOopDesc
1136 bool methodOopDesc::load_signature_classes(methodHandle m, TRAPS) {
1137   bool sig_is_loaded = true;
1138   Handle class_loader(THREAD, instanceKlass::cast(m->method_holder())->class_loader());


src/share/vm/oops/methodOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File