2539 // be single threaded in this method.
2540 assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
2541
2542 // Fill in the signature array, for the calling-convention call.
2543 int total_args_passed = method->size_of_parameters();
2544
2545 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
2546 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
2547
2548 // The signature we are going to use for the trap that dtrace will see
2549 // java/lang/String is converted. We drop "this" and any other object
2550 // is converted to NULL. (A one-slot java/lang/Long object reference
2551 // is converted to a two-slot long, which is why we double the allocation).
2552 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
2553 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
2554
2555 int i=0;
2556 int total_strings = 0;
2557 int first_arg_to_pass = 0;
2558 int total_c_args = 0;
2559 int box_offset = java_lang_boxing_object::value_offset_in_bytes();
2560
2561 // Skip the receiver as dtrace doesn't want to see it
2562 if( !method->is_static() ) {
2563 in_sig_bt[i++] = T_OBJECT;
2564 first_arg_to_pass = 1;
2565 }
2566
2567 SignatureStream ss(method->signature());
2568 for ( ; !ss.at_return_type(); ss.next()) {
2569 BasicType bt = ss.type();
2570 in_sig_bt[i++] = bt; // Collect remaining bits of signature
2571 out_sig_bt[total_c_args++] = bt;
2572 if( bt == T_OBJECT) {
2573 symbolOop s = ss.as_symbol_or_null();
2574 if (s == vmSymbols::java_lang_String()) {
2575 total_strings++;
2576 out_sig_bt[total_c_args-1] = T_ADDRESS;
2577 } else if (s == vmSymbols::java_lang_Boolean() ||
2578 s == vmSymbols::java_lang_Byte()) {
2579 out_sig_bt[total_c_args-1] = T_BYTE;
2761 in_reg = src.first()->as_Register();
2762 } else {
2763 assert(Assembler::is_simm13(reg2offset(src.first()) + STACK_BIAS),
2764 "must be");
2765 __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, in_reg);
2766 }
2767 // If the final destination is an acceptable register
2768 if ( dst.first()->is_reg() ) {
2769 if ( dst.is_single_phys_reg() || out_sig_bt[c_arg] != T_LONG ) {
2770 tmp = dst.first()->as_Register();
2771 }
2772 }
2773
2774 Label skipUnbox;
2775 if ( wordSize == 4 && out_sig_bt[c_arg] == T_LONG ) {
2776 __ mov(G0, tmp->successor());
2777 }
2778 __ br_null(in_reg, true, Assembler::pn, skipUnbox);
2779 __ delayed()->mov(G0, tmp);
2780
2781 switch (out_sig_bt[c_arg]) {
2782 case T_BYTE:
2783 __ ldub(in_reg, box_offset, tmp); break;
2784 case T_SHORT:
2785 __ lduh(in_reg, box_offset, tmp); break;
2786 case T_INT:
2787 __ ld(in_reg, box_offset, tmp); break;
2788 case T_LONG:
2789 __ ld_long(in_reg, box_offset, tmp); break;
2790 default: ShouldNotReachHere();
2791 }
2792
2793 __ bind(skipUnbox);
2794 // If tmp wasn't final destination copy to final destination
2795 if (tmp == L2) {
2796 VMRegPair tmp_as_VM = reg64_to_VMRegPair(L2);
2797 if (out_sig_bt[c_arg] == T_LONG) {
2798 long_move(masm, tmp_as_VM, dst);
2799 } else {
2800 move32_64(masm, tmp_as_VM, out_regs[c_arg]);
2801 }
|
2539 // be single threaded in this method.
2540 assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
2541
2542 // Fill in the signature array, for the calling-convention call.
2543 int total_args_passed = method->size_of_parameters();
2544
2545 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
2546 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
2547
2548 // The signature we are going to use for the trap that dtrace will see
2549 // java/lang/String is converted. We drop "this" and any other object
2550 // is converted to NULL. (A one-slot java/lang/Long object reference
2551 // is converted to a two-slot long, which is why we double the allocation).
2552 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
2553 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
2554
2555 int i=0;
2556 int total_strings = 0;
2557 int first_arg_to_pass = 0;
2558 int total_c_args = 0;
2559
2560 // Skip the receiver as dtrace doesn't want to see it
2561 if( !method->is_static() ) {
2562 in_sig_bt[i++] = T_OBJECT;
2563 first_arg_to_pass = 1;
2564 }
2565
2566 SignatureStream ss(method->signature());
2567 for ( ; !ss.at_return_type(); ss.next()) {
2568 BasicType bt = ss.type();
2569 in_sig_bt[i++] = bt; // Collect remaining bits of signature
2570 out_sig_bt[total_c_args++] = bt;
2571 if( bt == T_OBJECT) {
2572 symbolOop s = ss.as_symbol_or_null();
2573 if (s == vmSymbols::java_lang_String()) {
2574 total_strings++;
2575 out_sig_bt[total_c_args-1] = T_ADDRESS;
2576 } else if (s == vmSymbols::java_lang_Boolean() ||
2577 s == vmSymbols::java_lang_Byte()) {
2578 out_sig_bt[total_c_args-1] = T_BYTE;
2760 in_reg = src.first()->as_Register();
2761 } else {
2762 assert(Assembler::is_simm13(reg2offset(src.first()) + STACK_BIAS),
2763 "must be");
2764 __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, in_reg);
2765 }
2766 // If the final destination is an acceptable register
2767 if ( dst.first()->is_reg() ) {
2768 if ( dst.is_single_phys_reg() || out_sig_bt[c_arg] != T_LONG ) {
2769 tmp = dst.first()->as_Register();
2770 }
2771 }
2772
2773 Label skipUnbox;
2774 if ( wordSize == 4 && out_sig_bt[c_arg] == T_LONG ) {
2775 __ mov(G0, tmp->successor());
2776 }
2777 __ br_null(in_reg, true, Assembler::pn, skipUnbox);
2778 __ delayed()->mov(G0, tmp);
2779
2780 BasicType bt = out_sig_bt[c_arg];
2781 int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
2782 switch (bt) {
2783 case T_BYTE:
2784 __ ldub(in_reg, box_offset, tmp); break;
2785 case T_SHORT:
2786 __ lduh(in_reg, box_offset, tmp); break;
2787 case T_INT:
2788 __ ld(in_reg, box_offset, tmp); break;
2789 case T_LONG:
2790 __ ld_long(in_reg, box_offset, tmp); break;
2791 default: ShouldNotReachHere();
2792 }
2793
2794 __ bind(skipUnbox);
2795 // If tmp wasn't final destination copy to final destination
2796 if (tmp == L2) {
2797 VMRegPair tmp_as_VM = reg64_to_VMRegPair(L2);
2798 if (out_sig_bt[c_arg] == T_LONG) {
2799 long_move(masm, tmp_as_VM, dst);
2800 } else {
2801 move32_64(masm, tmp_as_VM, out_regs[c_arg]);
2802 }
|