1357 if (callee != NULL) {
1358 assert(callee->is_compiled(), "must be nmethod for patching");
1359 }
1360
1361 if (callee != NULL && !callee->is_in_use()) {
1362 // Patch call site to C2I adapter if callee nmethod is deoptimized or unloaded.
1363 callee = NULL;
1364 }
1365 nmethodLocker nl_callee(callee);
1366 #ifdef ASSERT
1367 address dest_entry_point = callee == NULL ? 0 : callee->entry_point(); // used below
1368 #endif
1369
1370 bool is_nmethod = caller_nm->is_nmethod();
1371
1372 if (is_virtual) {
1373 Klass* receiver_klass = NULL;
1374 if (ValueTypePassFieldsAsArgs && callee_method->method_holder()->is_value()) {
1375 // If the receiver is a value type that is passed as fields, no oop is available
1376 receiver_klass = callee_method->method_holder();
1377 if (FullGCALotWithValueTypes) {
1378 // Trigger a full GC to verify that the GC knows about the contents of oop fields
1379 Universe::heap()->collect(GCCause::_full_gc_alot);
1380 }
1381 } else {
1382 assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check");
1383 receiver_klass = invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass();
1384 }
1385 bool static_bound = call_info.resolved_method()->can_be_statically_bound();
1386 CompiledIC::compute_monomorphic_entry(callee_method, receiver_klass,
1387 is_optimized, static_bound, is_nmethod, virtual_call_info,
1388 CHECK_(methodHandle()));
1389 } else {
1390 // static call
1391 CompiledStaticCall::compute_entry(callee_method, is_nmethod, static_call_info);
1392 }
1393
1394 // grab lock, check for deoptimization and potentially patch caller
1395 {
1396 MutexLocker ml_patch(CompiledIC_lock);
1397
1398 // Lock blocks for safepoint during which both nmethods can change state.
1399
1400 // Now that we are ready to patch if the Method* was redefined then
3031 s++; len--; // Skip opening paren
3032
3033 BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
3034 VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
3035 int cnt = 0;
3036 if (has_receiver) {
3037 sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
3038 }
3039
3040 while (*s != ')') { // Find closing right paren
3041 switch (*s++) { // Switch on signature character
3042 case 'B': sig_bt[cnt++] = T_BYTE; break;
3043 case 'C': sig_bt[cnt++] = T_CHAR; break;
3044 case 'D': sig_bt[cnt++] = T_DOUBLE; sig_bt[cnt++] = T_VOID; break;
3045 case 'F': sig_bt[cnt++] = T_FLOAT; break;
3046 case 'I': sig_bt[cnt++] = T_INT; break;
3047 case 'J': sig_bt[cnt++] = T_LONG; sig_bt[cnt++] = T_VOID; break;
3048 case 'S': sig_bt[cnt++] = T_SHORT; break;
3049 case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
3050 case 'V': sig_bt[cnt++] = T_VOID; break;
3051 case 'L': // Oop
3052 while (*s++ != ';'); // Skip signature
3053 sig_bt[cnt++] = T_OBJECT;
3054 break;
3055 case '[': { // Array
3056 do { // Skip optional size
3057 while (*s >= '0' && *s <= '9') s++;
3058 } while (*s++ == '['); // Nested arrays?
3059 // Skip element type
3060 if (s[-1] == 'L')
3061 while (*s++ != ';'); // Skip signature
3062 sig_bt[cnt++] = T_ARRAY;
3063 break;
3064 }
3065 default : ShouldNotReachHere();
3066 }
3067 }
3068
3069 if (has_appendix) {
3070 sig_bt[cnt++] = T_OBJECT;
3071 }
3072
3073 assert(cnt < 256, "grow table size");
3074
3075 int comp_args_on_stack;
3076 comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
3077
3078 // the calling convention doesn't count out_preserve_stack_slots so
3079 // we must add that in to get "true" stack offsets.
3080
|
1357 if (callee != NULL) {
1358 assert(callee->is_compiled(), "must be nmethod for patching");
1359 }
1360
1361 if (callee != NULL && !callee->is_in_use()) {
1362 // Patch call site to C2I adapter if callee nmethod is deoptimized or unloaded.
1363 callee = NULL;
1364 }
1365 nmethodLocker nl_callee(callee);
1366 #ifdef ASSERT
1367 address dest_entry_point = callee == NULL ? 0 : callee->entry_point(); // used below
1368 #endif
1369
1370 bool is_nmethod = caller_nm->is_nmethod();
1371
1372 if (is_virtual) {
1373 Klass* receiver_klass = NULL;
1374 if (ValueTypePassFieldsAsArgs && callee_method->method_holder()->is_value()) {
1375 // If the receiver is a value type that is passed as fields, no oop is available
1376 receiver_klass = callee_method->method_holder();
1377 } else {
1378 assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check");
1379 receiver_klass = invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass();
1380 }
1381 bool static_bound = call_info.resolved_method()->can_be_statically_bound();
1382 CompiledIC::compute_monomorphic_entry(callee_method, receiver_klass,
1383 is_optimized, static_bound, is_nmethod, virtual_call_info,
1384 CHECK_(methodHandle()));
1385 } else {
1386 // static call
1387 CompiledStaticCall::compute_entry(callee_method, is_nmethod, static_call_info);
1388 }
1389
1390 // grab lock, check for deoptimization and potentially patch caller
1391 {
1392 MutexLocker ml_patch(CompiledIC_lock);
1393
1394 // Lock blocks for safepoint during which both nmethods can change state.
1395
1396 // Now that we are ready to patch if the Method* was redefined then
3027 s++; len--; // Skip opening paren
3028
3029 BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
3030 VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
3031 int cnt = 0;
3032 if (has_receiver) {
3033 sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
3034 }
3035
3036 while (*s != ')') { // Find closing right paren
3037 switch (*s++) { // Switch on signature character
3038 case 'B': sig_bt[cnt++] = T_BYTE; break;
3039 case 'C': sig_bt[cnt++] = T_CHAR; break;
3040 case 'D': sig_bt[cnt++] = T_DOUBLE; sig_bt[cnt++] = T_VOID; break;
3041 case 'F': sig_bt[cnt++] = T_FLOAT; break;
3042 case 'I': sig_bt[cnt++] = T_INT; break;
3043 case 'J': sig_bt[cnt++] = T_LONG; sig_bt[cnt++] = T_VOID; break;
3044 case 'S': sig_bt[cnt++] = T_SHORT; break;
3045 case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
3046 case 'V': sig_bt[cnt++] = T_VOID; break;
3047 case 'Q':
3048 case 'L': // Oop
3049 while (*s++ != ';'); // Skip signature
3050 sig_bt[cnt++] = T_OBJECT;
3051 break;
3052 case '[': { // Array
3053 do { // Skip optional size
3054 while (*s >= '0' && *s <= '9') s++;
3055 } while (*s++ == '['); // Nested arrays?
3056 // Skip element type
3057 if (s[-1] == 'L' || s[-1] == 'Q')
3058 while (*s++ != ';'); // Skip signature
3059 sig_bt[cnt++] = T_ARRAY;
3060 break;
3061 }
3062 default : ShouldNotReachHere();
3063 }
3064 }
3065
3066 if (has_appendix) {
3067 sig_bt[cnt++] = T_OBJECT;
3068 }
3069
3070 assert(cnt < 256, "grow table size");
3071
3072 int comp_args_on_stack;
3073 comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
3074
3075 // the calling convention doesn't count out_preserve_stack_slots so
3076 // we must add that in to get "true" stack offsets.
3077
|