2944 if (buf != NULL) { 2945 CodeBuffer buffer(buf); 2946 double locs_buf[20]; 2947 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); 2948 MacroAssembler _masm(&buffer); 2949 2950 // Fill in the signature array, for the calling-convention call. 2951 const int total_args_passed = method->size_of_parameters(); 2952 2953 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed); 2954 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed); 2955 int i=0; 2956 if (!method->is_static()) // Pass in receiver first 2957 sig_bt[i++] = T_OBJECT; 2958 SignatureStream ss(method->signature()); 2959 for (; !ss.at_return_type(); ss.next()) { 2960 BasicType bt = ss.type(); 2961 if (bt == T_VALUETYPE) { 2962 #ifdef ASSERT 2963 Thread* THREAD = Thread::current(); 2964 Handle class_loader(THREAD, method->method_holder()->class_loader()); 2965 Handle protection_domain(THREAD, method->method_holder()->protection_domain()); 2966 Klass* k = ss.as_klass(class_loader, protection_domain, SignatureStream::ReturnNull, THREAD); 2967 assert(k != NULL && !HAS_PENDING_EXCEPTION, "can't resolve klass"); 2968 assert(k == SystemDictionary::___Value_klass(), "other values not supported"); 2969 #endif 2970 bt = T_VALUETYPEPTR; 2971 } 2972 sig_bt[i++] = bt; // Collect remaining bits of signature 2973 if (ss.type() == T_LONG || ss.type() == T_DOUBLE) 2974 sig_bt[i++] = T_VOID; // Longs & doubles take 2 Java slots 2975 } 2976 assert(i == total_args_passed, ""); 2977 BasicType ret_type = ss.type(); 2978 2979 // Now get the compiled-Java layout as input (or output) arguments. 2980 // NOTE: Stubs for compiled entry points of method handle intrinsics 2981 // are just trampolines so the argument registers must be outgoing ones. 2982 const bool is_outgoing = method->is_method_handle_intrinsic(); 2983 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing); 2984 2985 // Generate the compiled-to-native wrapper code 2986 nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type); 2987 2988 if (nm != NULL) { | 2944 if (buf != NULL) { 2945 CodeBuffer buffer(buf); 2946 double locs_buf[20]; 2947 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); 2948 MacroAssembler _masm(&buffer); 2949 2950 // Fill in the signature array, for the calling-convention call. 2951 const int total_args_passed = method->size_of_parameters(); 2952 2953 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed); 2954 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed); 2955 int i=0; 2956 if (!method->is_static()) // Pass in receiver first 2957 sig_bt[i++] = T_OBJECT; 2958 SignatureStream ss(method->signature()); 2959 for (; !ss.at_return_type(); ss.next()) { 2960 BasicType bt = ss.type(); 2961 if (bt == T_VALUETYPE) { 2962 #ifdef ASSERT 2963 Thread* THREAD = Thread::current(); 2964 // Avoid class loading from compiler thread 2965 if (THREAD->can_call_java()) { 2966 Handle class_loader(THREAD, method->method_holder()->class_loader()); 2967 Handle protection_domain(THREAD, method->method_holder()->protection_domain()); 2968 Klass* k = ss.as_klass(class_loader, protection_domain, SignatureStream::ReturnNull, THREAD); 2969 assert(k != NULL && !HAS_PENDING_EXCEPTION, "can't resolve klass"); 2970 assert(k == SystemDictionary::___Value_klass(), "other values not supported"); 2971 } 2972 #endif 2973 bt = T_VALUETYPEPTR; 2974 } 2975 sig_bt[i++] = bt; // Collect remaining bits of signature 2976 if (ss.type() == T_LONG || ss.type() == T_DOUBLE) 2977 sig_bt[i++] = T_VOID; // Longs & doubles take 2 Java slots 2978 } 2979 assert(i == total_args_passed, ""); 2980 BasicType ret_type = ss.type(); 2981 2982 // Now get the compiled-Java layout as input (or output) arguments. 2983 // NOTE: Stubs for compiled entry points of method handle intrinsics 2984 // are just trampolines so the argument registers must be outgoing ones. 2985 const bool is_outgoing = method->is_method_handle_intrinsic(); 2986 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing); 2987 2988 // Generate the compiled-to-native wrapper code 2989 nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type); 2990 2991 if (nm != NULL) { |