872
873 __ bind(ok);
874 // Method might have been compiled since the call site was patched to
875 // interpreted if that is the case treat it as a miss so we can get
876 // the call site corrected.
877 __ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
878 __ jcc(Assembler::equal, skip_fixup);
879 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
880 }
881
882 address c2i_entry = __ pc();
883
884 gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
885
886 __ flush();
887 return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
888 }
889
890 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
891 VMRegPair *regs,
892 int total_args_passed) {
893 // We return the amount of VMRegImpl stack slots we need to reserve for all
894 // the arguments NOT counting out_preserve_stack_slots.
895
896 // NOTE: These arrays will have to change when c1 is ported
897 #ifdef _WIN64
898 static const Register INT_ArgReg[Argument::n_int_register_parameters_c] = {
899 c_rarg0, c_rarg1, c_rarg2, c_rarg3
900 };
901 static const XMMRegister FP_ArgReg[Argument::n_float_register_parameters_c] = {
902 c_farg0, c_farg1, c_farg2, c_farg3
903 };
904 #else
905 static const Register INT_ArgReg[Argument::n_int_register_parameters_c] = {
906 c_rarg0, c_rarg1, c_rarg2, c_rarg3, c_rarg4, c_rarg5
907 };
908 static const XMMRegister FP_ArgReg[Argument::n_float_register_parameters_c] = {
909 c_farg0, c_farg1, c_farg2, c_farg3,
910 c_farg4, c_farg5, c_farg6, c_farg7
911 };
912 #endif // _WIN64
1840 case 'J': in_elem_bt[i] = T_LONG; break;
1841 case 'S': in_elem_bt[i] = T_SHORT; break;
1842 case 'Z': in_elem_bt[i] = T_BOOLEAN; break;
1843 default: ShouldNotReachHere();
1844 }
1845 }
1846 } else {
1847 out_sig_bt[argc++] = in_sig_bt[i];
1848 in_elem_bt[i] = T_VOID;
1849 }
1850 if (in_sig_bt[i] != T_VOID) {
1851 assert(in_sig_bt[i] == ss.type(), "must match");
1852 ss.next();
1853 }
1854 }
1855 }
1856
1857 // Now figure out where the args must be stored and how much stack space
1858 // they require.
1859 int out_arg_slots;
1860 out_arg_slots = c_calling_convention(out_sig_bt, out_regs, total_c_args);
1861
1862 // Compute framesize for the wrapper. We need to handlize all oops in
1863 // incoming registers
1864
1865 // Calculate the total number of stack slots we will need.
1866
1867 // First count the abi requirement plus all of the outgoing args
1868 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
1869
1870 // Now the space for the inbound oop handle area
1871 int total_save_slots = 6 * VMRegImpl::slots_per_word; // 6 arguments passed in registers
1872 if (is_critical_native) {
1873 // Critical natives may have to call out so they need a save area
1874 // for register arguments.
1875 int double_slots = 0;
1876 int single_slots = 0;
1877 for ( int i = 0; i < total_in_args; i++) {
1878 if (in_regs[i].first()->is_Register()) {
1879 const Register reg = in_regs[i].first()->as_Register();
1880 switch (in_sig_bt[i]) {
2744 out_sig_bt[total_c_args-1] = T_LONG;
2745 out_sig_bt[total_c_args++] = T_VOID;
2746 } else if ( bt == T_FLOAT) {
2747 // We convert float to int
2748 out_sig_bt[total_c_args-1] = T_INT;
2749 }
2750 }
2751
2752 assert(i==total_args_passed, "validly parsed signature");
2753
2754 // Now get the compiled-Java layout as input arguments
2755 int comp_args_on_stack;
2756 comp_args_on_stack = SharedRuntime::java_calling_convention(
2757 in_sig_bt, in_regs, total_args_passed, false);
2758
2759 // Now figure out where the args must be stored and how much stack space
2760 // they require (neglecting out_preserve_stack_slots but space for storing
2761 // the 1st six register arguments). It's weird see int_stk_helper.
2762
2763 int out_arg_slots;
2764 out_arg_slots = c_calling_convention(out_sig_bt, out_regs, total_c_args);
2765
2766 // Calculate the total number of stack slots we will need.
2767
2768 // First count the abi requirement plus all of the outgoing args
2769 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
2770
2771 // Now space for the string(s) we must convert
2772 int* string_locs = NEW_RESOURCE_ARRAY(int, total_strings + 1);
2773 for (i = 0; i < total_strings ; i++) {
2774 string_locs[i] = stack_slots;
2775 stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
2776 }
2777
2778 // Plus the temps we might need to juggle register args
2779 // regs take two slots each
2780 stack_slots += (Argument::n_int_register_parameters_c +
2781 Argument::n_float_register_parameters_c) * 2;
2782
2783
2784 // + 4 for return address (which we own) and saved rbp,
|
872
873 __ bind(ok);
874 // Method might have been compiled since the call site was patched to
875 // interpreted if that is the case treat it as a miss so we can get
876 // the call site corrected.
877 __ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
878 __ jcc(Assembler::equal, skip_fixup);
879 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
880 }
881
882 address c2i_entry = __ pc();
883
884 gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
885
886 __ flush();
887 return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
888 }
889
890 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
891 VMRegPair *regs,
892 VMRegPair *regs2,
893 int total_args_passed) {
894 assert(regs2 == NULL, "not needed on x86");
895 // We return the amount of VMRegImpl stack slots we need to reserve for all
896 // the arguments NOT counting out_preserve_stack_slots.
897
898 // NOTE: These arrays will have to change when c1 is ported
899 #ifdef _WIN64
900 static const Register INT_ArgReg[Argument::n_int_register_parameters_c] = {
901 c_rarg0, c_rarg1, c_rarg2, c_rarg3
902 };
903 static const XMMRegister FP_ArgReg[Argument::n_float_register_parameters_c] = {
904 c_farg0, c_farg1, c_farg2, c_farg3
905 };
906 #else
907 static const Register INT_ArgReg[Argument::n_int_register_parameters_c] = {
908 c_rarg0, c_rarg1, c_rarg2, c_rarg3, c_rarg4, c_rarg5
909 };
910 static const XMMRegister FP_ArgReg[Argument::n_float_register_parameters_c] = {
911 c_farg0, c_farg1, c_farg2, c_farg3,
912 c_farg4, c_farg5, c_farg6, c_farg7
913 };
914 #endif // _WIN64
1842 case 'J': in_elem_bt[i] = T_LONG; break;
1843 case 'S': in_elem_bt[i] = T_SHORT; break;
1844 case 'Z': in_elem_bt[i] = T_BOOLEAN; break;
1845 default: ShouldNotReachHere();
1846 }
1847 }
1848 } else {
1849 out_sig_bt[argc++] = in_sig_bt[i];
1850 in_elem_bt[i] = T_VOID;
1851 }
1852 if (in_sig_bt[i] != T_VOID) {
1853 assert(in_sig_bt[i] == ss.type(), "must match");
1854 ss.next();
1855 }
1856 }
1857 }
1858
1859 // Now figure out where the args must be stored and how much stack space
1860 // they require.
1861 int out_arg_slots;
1862 out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
1863
1864 // Compute framesize for the wrapper. We need to handlize all oops in
1865 // incoming registers
1866
1867 // Calculate the total number of stack slots we will need.
1868
1869 // First count the abi requirement plus all of the outgoing args
1870 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
1871
1872 // Now the space for the inbound oop handle area
1873 int total_save_slots = 6 * VMRegImpl::slots_per_word; // 6 arguments passed in registers
1874 if (is_critical_native) {
1875 // Critical natives may have to call out so they need a save area
1876 // for register arguments.
1877 int double_slots = 0;
1878 int single_slots = 0;
1879 for ( int i = 0; i < total_in_args; i++) {
1880 if (in_regs[i].first()->is_Register()) {
1881 const Register reg = in_regs[i].first()->as_Register();
1882 switch (in_sig_bt[i]) {
2746 out_sig_bt[total_c_args-1] = T_LONG;
2747 out_sig_bt[total_c_args++] = T_VOID;
2748 } else if ( bt == T_FLOAT) {
2749 // We convert float to int
2750 out_sig_bt[total_c_args-1] = T_INT;
2751 }
2752 }
2753
2754 assert(i==total_args_passed, "validly parsed signature");
2755
2756 // Now get the compiled-Java layout as input arguments
2757 int comp_args_on_stack;
2758 comp_args_on_stack = SharedRuntime::java_calling_convention(
2759 in_sig_bt, in_regs, total_args_passed, false);
2760
2761 // Now figure out where the args must be stored and how much stack space
2762 // they require (neglecting out_preserve_stack_slots but space for storing
2763 // the 1st six register arguments). It's weird see int_stk_helper.
2764
2765 int out_arg_slots;
2766 out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
2767
2768 // Calculate the total number of stack slots we will need.
2769
2770 // First count the abi requirement plus all of the outgoing args
2771 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
2772
2773 // Now space for the string(s) we must convert
2774 int* string_locs = NEW_RESOURCE_ARRAY(int, total_strings + 1);
2775 for (i = 0; i < total_strings ; i++) {
2776 string_locs[i] = stack_slots;
2777 stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
2778 }
2779
2780 // Plus the temps we might need to juggle register args
2781 // regs take two slots each
2782 stack_slots += (Argument::n_int_register_parameters_c +
2783 Argument::n_float_register_parameters_c) * 2;
2784
2785
2786 // + 4 for return address (which we own) and saved rbp,
|