1933
1934 offsets_initialized = true;
1935 }
1936 // Fill in the signature array, for the calling-convention call.
1937 int total_args_passed = method->size_of_parameters();
1938
1939 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
1940 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
1941
1942 // The signature we are going to use for the trap that dtrace will see
1943 // java/lang/String is converted. We drop "this" and any other object
1944 // is converted to NULL. (A one-slot java/lang/Long object reference
1945 // is converted to a two-slot long, which is why we double the allocation).
1946 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
1947 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
1948
1949 int i=0;
1950 int total_strings = 0;
1951 int first_arg_to_pass = 0;
1952 int total_c_args = 0;
1953 int box_offset = java_lang_boxing_object::value_offset_in_bytes();
1954
1955 // Skip the receiver as dtrace doesn't want to see it
1956 if( !method->is_static() ) {
1957 in_sig_bt[i++] = T_OBJECT;
1958 first_arg_to_pass = 1;
1959 }
1960
1961 // We need to convert the java args to where a native (non-jni) function
1962 // would expect them. To figure out where they go we convert the java
1963 // signature to a C signature.
1964
1965 SignatureStream ss(method->signature());
1966 for ( ; !ss.at_return_type(); ss.next()) {
1967 BasicType bt = ss.type();
1968 in_sig_bt[i++] = bt; // Collect remaining bits of signature
1969 out_sig_bt[total_c_args++] = bt;
1970 if( bt == T_OBJECT) {
1971 symbolOop s = ss.as_symbol_or_null();
1972 if (s == vmSymbols::java_lang_String()) {
1973 total_strings++;
2180 case T_ARRAY:
2181 case T_OBJECT:
2182 {
2183 Address stack_dst(rsp, reg2offset_out(dst.first()));
2184
2185 if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2186 // need to unbox a one-word value
2187 Register in_reg = rax;
2188 if ( src.first()->is_reg() ) {
2189 in_reg = src.first()->as_Register();
2190 } else {
2191 __ movq(rax, Address(rbp, reg2offset_in(src.first())));
2192 rax_is_zero = false;
2193 }
2194 Label skipUnbox;
2195 __ movptr(Address(rsp, reg2offset_out(dst.first())),
2196 (int32_t)NULL_WORD);
2197 __ testq(in_reg, in_reg);
2198 __ jcc(Assembler::zero, skipUnbox);
2199
2200 Address src1(in_reg, box_offset);
2201 if ( out_sig_bt[c_arg] == T_LONG ) {
2202 __ movq(in_reg, src1);
2203 __ movq(stack_dst, in_reg);
2204 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2205 ++c_arg; // skip over T_VOID to keep the loop indices in sync
2206 } else {
2207 __ movl(in_reg, src1);
2208 __ movl(stack_dst, in_reg);
2209 }
2210
2211 __ bind(skipUnbox);
2212 } else if (out_sig_bt[c_arg] != T_ADDRESS) {
2213 // Convert the arg to NULL
2214 if (!rax_is_zero) {
2215 __ xorq(rax, rax);
2216 rax_is_zero = true;
2217 }
2218 __ movq(stack_dst, rax);
2219 }
2220 }
2221 break;
2443 __ movl(r, Address(rbp, fp_offset[src.first()->value()]));
2444 }
2445 }
2446 }
2447 live[src.first()->value()] = false;
2448 } else if (!useless) {
2449 // full sized move even for int should be ok
2450 __ movq(r, Address(rbp, reg2offset_in(src.first())));
2451 }
2452
2453 // At this point r has the original java arg in the final location
2454 // (assuming it wasn't useless). If the java arg was an oop
2455 // we have a bit more to do
2456
2457 if (in_sig_bt[j_arg] == T_ARRAY || in_sig_bt[j_arg] == T_OBJECT ) {
2458 if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2459 // need to unbox a one-word value
2460 Label skip;
2461 __ testq(r, r);
2462 __ jcc(Assembler::equal, skip);
2463 Address src1(r, box_offset);
2464 if ( out_sig_bt[c_arg] == T_LONG ) {
2465 __ movq(r, src1);
2466 } else {
2467 __ movl(r, src1);
2468 }
2469 __ bind(skip);
2470
2471 } else if (out_sig_bt[c_arg] != T_ADDRESS) {
2472 // Convert the arg to NULL
2473 __ xorq(r, r);
2474 }
2475 }
2476
2477 // dst can longer be holding an input value
2478 live[dst.first()->value()] = false;
2479 }
2480 if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
2481 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2482 ++c_arg; // skip over T_VOID to keep the loop indices in sync
2483 }
2484 }
|
1933
1934 offsets_initialized = true;
1935 }
1936 // Fill in the signature array, for the calling-convention call.
1937 int total_args_passed = method->size_of_parameters();
1938
1939 BasicType* in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
1940 VMRegPair *in_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
1941
1942 // The signature we are going to use for the trap that dtrace will see
1943 // java/lang/String is converted. We drop "this" and any other object
1944 // is converted to NULL. (A one-slot java/lang/Long object reference
1945 // is converted to a two-slot long, which is why we double the allocation).
1946 BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
1947 VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
1948
1949 int i=0;
1950 int total_strings = 0;
1951 int first_arg_to_pass = 0;
1952 int total_c_args = 0;
1953
1954 // Skip the receiver as dtrace doesn't want to see it
1955 if( !method->is_static() ) {
1956 in_sig_bt[i++] = T_OBJECT;
1957 first_arg_to_pass = 1;
1958 }
1959
1960 // We need to convert the java args to where a native (non-jni) function
1961 // would expect them. To figure out where they go we convert the java
1962 // signature to a C signature.
1963
1964 SignatureStream ss(method->signature());
1965 for ( ; !ss.at_return_type(); ss.next()) {
1966 BasicType bt = ss.type();
1967 in_sig_bt[i++] = bt; // Collect remaining bits of signature
1968 out_sig_bt[total_c_args++] = bt;
1969 if( bt == T_OBJECT) {
1970 symbolOop s = ss.as_symbol_or_null();
1971 if (s == vmSymbols::java_lang_String()) {
1972 total_strings++;
2179 case T_ARRAY:
2180 case T_OBJECT:
2181 {
2182 Address stack_dst(rsp, reg2offset_out(dst.first()));
2183
2184 if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2185 // need to unbox a one-word value
2186 Register in_reg = rax;
2187 if ( src.first()->is_reg() ) {
2188 in_reg = src.first()->as_Register();
2189 } else {
2190 __ movq(rax, Address(rbp, reg2offset_in(src.first())));
2191 rax_is_zero = false;
2192 }
2193 Label skipUnbox;
2194 __ movptr(Address(rsp, reg2offset_out(dst.first())),
2195 (int32_t)NULL_WORD);
2196 __ testq(in_reg, in_reg);
2197 __ jcc(Assembler::zero, skipUnbox);
2198
2199 BasicType bt = out_sig_bt[c_arg];
2200 int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
2201 Address src1(in_reg, box_offset);
2202 if ( bt == T_LONG ) {
2203 __ movq(in_reg, src1);
2204 __ movq(stack_dst, in_reg);
2205 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2206 ++c_arg; // skip over T_VOID to keep the loop indices in sync
2207 } else {
2208 __ movl(in_reg, src1);
2209 __ movl(stack_dst, in_reg);
2210 }
2211
2212 __ bind(skipUnbox);
2213 } else if (out_sig_bt[c_arg] != T_ADDRESS) {
2214 // Convert the arg to NULL
2215 if (!rax_is_zero) {
2216 __ xorq(rax, rax);
2217 rax_is_zero = true;
2218 }
2219 __ movq(stack_dst, rax);
2220 }
2221 }
2222 break;
2444 __ movl(r, Address(rbp, fp_offset[src.first()->value()]));
2445 }
2446 }
2447 }
2448 live[src.first()->value()] = false;
2449 } else if (!useless) {
2450 // full sized move even for int should be ok
2451 __ movq(r, Address(rbp, reg2offset_in(src.first())));
2452 }
2453
2454 // At this point r has the original java arg in the final location
2455 // (assuming it wasn't useless). If the java arg was an oop
2456 // we have a bit more to do
2457
2458 if (in_sig_bt[j_arg] == T_ARRAY || in_sig_bt[j_arg] == T_OBJECT ) {
2459 if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
2460 // need to unbox a one-word value
2461 Label skip;
2462 __ testq(r, r);
2463 __ jcc(Assembler::equal, skip);
2464 BasicType bt = out_sig_bt[c_arg];
2465 int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
2466 Address src1(r, box_offset);
2467 if ( bt == T_LONG ) {
2468 __ movq(r, src1);
2469 } else {
2470 __ movl(r, src1);
2471 }
2472 __ bind(skip);
2473
2474 } else if (out_sig_bt[c_arg] != T_ADDRESS) {
2475 // Convert the arg to NULL
2476 __ xorq(r, r);
2477 }
2478 }
2479
2480 // dst can longer be holding an input value
2481 live[dst.first()->value()] = false;
2482 }
2483 if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
2484 assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
2485 ++c_arg; // skip over T_VOID to keep the loop indices in sync
2486 }
2487 }
|