< prev index next >

src/share/vm/runtime/sharedRuntime.cpp

Print this page
rev 8611 : 8086069: Adapt runtime calls to recent intrinsics to pass ints as long
Summary: Remove CCallingConventionRequiresIntsAsLongs from shared code and push functionality to native wrapper. Less optimal but more flexible.


2599       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2600     }
2601     nm->post_compiled_method_load_event();
2602   }
2603 }
2604 
2605 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2606   assert(thread == JavaThread::current(), "must be");
2607   // The code is about to enter a JNI lazy critical native method and
2608   // _needs_gc is true, so if this thread is already in a critical
2609   // section then just return, otherwise this thread should block
2610   // until needs_gc has been cleared.
2611   if (thread->in_critical()) {
2612     return;
2613   }
2614   // Lock and unlock a critical section to give the system a chance to block
2615   GC_locker::lock_critical(thread);
2616   GC_locker::unlock_critical(thread);
2617 JRT_END
2618 
2619 int SharedRuntime::convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt) {
2620   int argcnt = in_args_count;
2621   if (CCallingConventionRequiresIntsAsLongs) {
2622     for (int in = 0; in < in_args_count; in++) {
2623       BasicType bt = in_sig_bt[in];
2624       switch (bt) {
2625         case T_BOOLEAN:
2626         case T_CHAR:
2627         case T_BYTE:
2628         case T_SHORT:
2629         case T_INT:
2630           argcnt++;
2631           break;
2632         default:
2633           break;
2634       }
2635     }
2636   } else {
2637     assert(0, "This should not be needed on this platform");
2638   }
2639 
2640   return argcnt;
2641 }
2642 
2643 void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
2644                                              BasicType*& in_sig_bt, VMRegPair*& in_regs) {
2645   if (CCallingConventionRequiresIntsAsLongs) {
2646     VMRegPair *new_in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, i2l_argcnt);
2647     BasicType *new_in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt);
2648 
2649     int argcnt = 0;
2650     for (int in = 0; in < in_args_count; in++, argcnt++) {
2651       BasicType bt  = in_sig_bt[in];
2652       VMRegPair reg = in_regs[in];
2653       switch (bt) {
2654         case T_BOOLEAN:
2655         case T_CHAR:
2656         case T_BYTE:
2657         case T_SHORT:
2658         case T_INT:
2659           // Convert (bt) to (T_LONG,bt).
2660           new_in_sig_bt[argcnt] = T_LONG;
2661           new_in_sig_bt[argcnt+1] = bt;
2662           assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
2663           new_in_regs[argcnt].set2(reg.first());
2664           new_in_regs[argcnt+1].set_bad();
2665           argcnt++;
2666           break;
2667         default:
2668           // No conversion needed.
2669           new_in_sig_bt[argcnt] = bt;
2670           new_in_regs[argcnt]   = reg;
2671           break;
2672       }
2673     }
2674     assert(argcnt == i2l_argcnt, "must match");
2675 
2676     in_regs = new_in_regs;
2677     in_sig_bt = new_in_sig_bt;
2678     in_args_count = i2l_argcnt;
2679   } else {
2680     assert(0, "This should not be needed on this platform");
2681   }
2682 }
2683 
2684 // -------------------------------------------------------------------------
2685 // Java-Java calling convention
2686 // (what you use when Java calls Java)
2687 
2688 //------------------------------name_for_receiver----------------------------------
2689 // For a given signature, return the VMReg for parameter 0.
2690 VMReg SharedRuntime::name_for_receiver() {
2691   VMRegPair regs;
2692   BasicType sig_bt = T_OBJECT;
2693   (void) java_calling_convention(&sig_bt, &regs, 1, true);
2694   // Return argument 0 register.  In the LP64 build pointers
2695   // take 2 registers, but the VM wants only the 'main' name.
2696   return regs.first();
2697 }
2698 
2699 VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
2700   // This method is returning a data structure allocating as a
2701   // ResourceObject, so do not put any ResourceMarks in here.
2702   char *s = sig->as_C_string();
2703   int len = (int)strlen(s);




2599       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2600     }
2601     nm->post_compiled_method_load_event();
2602   }
2603 }
2604 
2605 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2606   assert(thread == JavaThread::current(), "must be");
2607   // The code is about to enter a JNI lazy critical native method and
2608   // _needs_gc is true, so if this thread is already in a critical
2609   // section then just return, otherwise this thread should block
2610   // until needs_gc has been cleared.
2611   if (thread->in_critical()) {
2612     return;
2613   }
2614   // Lock and unlock a critical section to give the system a chance to block
2615   GC_locker::lock_critical(thread);
2616   GC_locker::unlock_critical(thread);
2617 JRT_END
2618 

































































2619 // -------------------------------------------------------------------------
2620 // Java-Java calling convention
2621 // (what you use when Java calls Java)
2622 
2623 //------------------------------name_for_receiver----------------------------------
2624 // For a given signature, return the VMReg for parameter 0.
2625 VMReg SharedRuntime::name_for_receiver() {
2626   VMRegPair regs;
2627   BasicType sig_bt = T_OBJECT;
2628   (void) java_calling_convention(&sig_bt, &regs, 1, true);
2629   // Return argument 0 register.  In the LP64 build pointers
2630   // take 2 registers, but the VM wants only the 'main' name.
2631   return regs.first();
2632 }
2633 
2634 VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
2635   // This method is returning a data structure allocating as a
2636   // ResourceObject, so do not put any ResourceMarks in here.
2637   char *s = sig->as_C_string();
2638   int len = (int)strlen(s);


< prev index next >