1903 // be single threaded in this method.
1904 assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
1905
1906 // Fill in the signature array, for the calling-convention call.
1907 int total_args_passed = method->size_of_parameters();
1908
1909 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
1910 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
1911
1912 // The signature we are going to use for the trap that dtrace will see
1913 // java/lang/String is converted. We drop "this" and any other object
1914 // is converted to NULL. (A one-slot java/lang/Long object reference
1915 // is converted to a two-slot long, which is why we double the allocation).
1916 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
1917 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
1918
1919 int i=0;
1920 int total_strings = 0;
1921 int first_arg_to_pass = 0;
1922 int total_c_args = 0;
1923 int box_offset = java_lang_boxing_object::value_offset_in_bytes();
1924
1925 if( !method->is_static() ) { // Pass in receiver first
1926 in_sig_bt[i++] = T_OBJECT;
1927 first_arg_to_pass = 1;
1928 }
1929
1930 // We need to convert the java args to where a native (non-jni) function
1931 // would expect them. To figure out where they go we convert the java
1932 // signature to a C signature.
1933
1934 SignatureStream ss(method->signature());
1935 for ( ; !ss.at_return_type(); ss.next()) {
1936 BasicType bt = ss.type();
1937 in_sig_bt[i++] = bt; // Collect remaining bits of signature
1938 out_sig_bt[total_c_args++] = bt;
1939 if( bt == T_OBJECT) {
1940 symbolOop s = ss.as_symbol_or_null();
1941 if (s == vmSymbols::java_lang_String()) {
1942 total_strings++;
1943 out_sig_bt[total_c_args-1] = T_ADDRESS;
2114 }
2115 }
2116 } else if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2117 // need to unbox a one-word value
2118 Register in_reg = rax;
2119 if ( src.first()->is_reg() ) {
2120 in_reg = src.first()->as_Register();
2121 } else {
2122 simple_move32(masm, src, in_reg->as_VMReg());
2123 }
2124 Label skipUnbox;
2125 __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
2126 if ( out_sig_bt[c_arg] == T_LONG ) {
2127 __ movl(Address(rsp, reg2offset_out(dst.second())), NULL_WORD);
2128 }
2129 __ testl(in_reg, in_reg);
2130 __ jcc(Assembler::zero, skipUnbox);
2131 assert(dst.first()->is_stack() &&
2132 (!dst.second()->is_valid() || dst.second()->is_stack()),
2133 "value(s) must go into stack slots");
2134 if ( out_sig_bt[c_arg] == T_LONG ) {
2135 __ movl(rbx, Address(in_reg,
2136 box_offset + VMRegImpl::stack_slot_size));
2137 __ movl(Address(rsp, reg2offset_out(dst.second())), rbx);
2138 }
2139 __ movl(in_reg, Address(in_reg, box_offset));
2140 __ movl(Address(rsp, reg2offset_out(dst.first())), in_reg);
2141 __ bind(skipUnbox);
2142 } else {
2143 // Convert the arg to NULL
2144 __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
2145 }
2146 if (out_sig_bt[c_arg] == T_LONG) {
2147 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2148 ++c_arg; // Move over the T_VOID To keep the loop indices in sync
2149 }
2150 break;
2151
2152 case T_VOID:
2153 break;
2154
|
1903 // be single threaded in this method.
1904 assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
1905
1906 // Fill in the signature array, for the calling-convention call.
1907 int total_args_passed = method->size_of_parameters();
1908
1909 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
1910 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
1911
1912 // The signature we are going to use for the trap that dtrace will see
1913 // java/lang/String is converted. We drop "this" and any other object
1914 // is converted to NULL. (A one-slot java/lang/Long object reference
1915 // is converted to a two-slot long, which is why we double the allocation).
1916 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
1917 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
1918
1919 int i=0;
1920 int total_strings = 0;
1921 int first_arg_to_pass = 0;
1922 int total_c_args = 0;
1923
1924 if( !method->is_static() ) { // Pass in receiver first
1925 in_sig_bt[i++] = T_OBJECT;
1926 first_arg_to_pass = 1;
1927 }
1928
1929 // We need to convert the java args to where a native (non-jni) function
1930 // would expect them. To figure out where they go we convert the java
1931 // signature to a C signature.
1932
1933 SignatureStream ss(method->signature());
1934 for ( ; !ss.at_return_type(); ss.next()) {
1935 BasicType bt = ss.type();
1936 in_sig_bt[i++] = bt; // Collect remaining bits of signature
1937 out_sig_bt[total_c_args++] = bt;
1938 if( bt == T_OBJECT) {
1939 symbolOop s = ss.as_symbol_or_null();
1940 if (s == vmSymbols::java_lang_String()) {
1941 total_strings++;
1942 out_sig_bt[total_c_args-1] = T_ADDRESS;
2113 }
2114 }
2115 } else if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2116 // need to unbox a one-word value
2117 Register in_reg = rax;
2118 if ( src.first()->is_reg() ) {
2119 in_reg = src.first()->as_Register();
2120 } else {
2121 simple_move32(masm, src, in_reg->as_VMReg());
2122 }
2123 Label skipUnbox;
2124 __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
2125 if ( out_sig_bt[c_arg] == T_LONG ) {
2126 __ movl(Address(rsp, reg2offset_out(dst.second())), NULL_WORD);
2127 }
2128 __ testl(in_reg, in_reg);
2129 __ jcc(Assembler::zero, skipUnbox);
2130 assert(dst.first()->is_stack() &&
2131 (!dst.second()->is_valid() || dst.second()->is_stack()),
2132 "value(s) must go into stack slots");
2133
2134 BasicType bt = out_sig_bt[c_arg];
2135 int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
2136 if ( bt == T_LONG ) {
2137 __ movl(rbx, Address(in_reg,
2138 box_offset + VMRegImpl::stack_slot_size));
2139 __ movl(Address(rsp, reg2offset_out(dst.second())), rbx);
2140 }
2141 __ movl(in_reg, Address(in_reg, box_offset));
2142 __ movl(Address(rsp, reg2offset_out(dst.first())), in_reg);
2143 __ bind(skipUnbox);
2144 } else {
2145 // Convert the arg to NULL
2146 __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
2147 }
2148 if (out_sig_bt[c_arg] == T_LONG) {
2149 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2150 ++c_arg; // Move over the T_VOID To keep the loop indices in sync
2151 }
2152 break;
2153
2154 case T_VOID:
2155 break;
2156
|