137 return cookie; |
137 return cookie; |
138 } |
138 } |
139 |
139 |
140 void MethodHandles::RicochetFrame::generate_ricochet_blob(MacroAssembler* _masm, |
140 void MethodHandles::RicochetFrame::generate_ricochet_blob(MacroAssembler* _masm, |
141 // output params: |
141 // output params: |
142 int* frame_size_in_words, |
|
143 int* bounce_offset, |
142 int* bounce_offset, |
144 int* exception_offset) { |
143 int* exception_offset, |
|
144 int* frame_size_in_words) { |
145 (*frame_size_in_words) = RicochetFrame::frame_size_in_bytes() / wordSize; |
145 (*frame_size_in_words) = RicochetFrame::frame_size_in_bytes() / wordSize; |
146 |
146 |
147 address start = __ pc(); |
147 address start = __ pc(); |
148 |
148 |
149 #ifdef ASSERT |
149 #ifdef ASSERT |
364 |
364 |
365 void MethodHandles::load_stack_move(MacroAssembler* _masm, |
365 void MethodHandles::load_stack_move(MacroAssembler* _masm, |
366 Register rdi_stack_move, |
366 Register rdi_stack_move, |
367 Register rcx_amh, |
367 Register rcx_amh, |
368 bool might_be_negative) { |
368 bool might_be_negative) { |
369 BLOCK_COMMENT("load_stack_move"); |
369 BLOCK_COMMENT("load_stack_move {"); |
370 Address rcx_amh_conversion(rcx_amh, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes()); |
370 Address rcx_amh_conversion(rcx_amh, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes()); |
371 __ movl(rdi_stack_move, rcx_amh_conversion); |
371 __ movl(rdi_stack_move, rcx_amh_conversion); |
372 __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT); |
372 __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT); |
373 #ifdef _LP64 |
373 #ifdef _LP64 |
374 if (might_be_negative) { |
374 if (might_be_negative) { |
385 __ jcc(Assembler::greater, L_ok); |
385 __ jcc(Assembler::greater, L_ok); |
386 __ bind(L_bad); |
386 __ bind(L_bad); |
387 __ stop("load_stack_move of garbage value"); |
387 __ stop("load_stack_move of garbage value"); |
388 __ BIND(L_ok); |
388 __ BIND(L_ok); |
389 } |
389 } |
|
390 BLOCK_COMMENT("} load_stack_move"); |
390 } |
391 } |
391 |
392 |
392 #ifdef ASSERT |
393 #ifdef ASSERT |
393 void MethodHandles::RicochetFrame::verify_offsets() { |
394 void MethodHandles::RicochetFrame::verify_offsets() { |
394 // Check compatibility of this struct with the more generally used offsets of class frame: |
395 // Check compatibility of this struct with the more generally used offsets of class frame: |
1145 |
1146 |
1146 address interp_entry = __ pc(); |
1147 address interp_entry = __ pc(); |
1147 |
1148 |
1148 trace_method_handle(_masm, entry_name(ek)); |
1149 trace_method_handle(_masm, entry_name(ek)); |
1149 |
1150 |
1150 BLOCK_COMMENT(entry_name(ek)); |
1151 BLOCK_COMMENT(err_msg("Entry %s {", entry_name(ek))); |
1151 |
1152 |
1152 switch ((int) ek) { |
1153 switch ((int) ek) { |
1153 case _raise_exception: |
1154 case _raise_exception: |
1154 { |
1155 { |
1155 // Not a real MH entry, but rather shared code for raising an |
1156 // Not a real MH entry, but rather shared code for raising an |
1290 case _bound_long_mh: |
1291 case _bound_long_mh: |
1291 case _bound_ref_direct_mh: |
1292 case _bound_ref_direct_mh: |
1292 case _bound_int_direct_mh: |
1293 case _bound_int_direct_mh: |
1293 case _bound_long_direct_mh: |
1294 case _bound_long_direct_mh: |
1294 { |
1295 { |
1295 bool direct_to_method = (ek >= _bound_ref_direct_mh); |
1296 const bool direct_to_method = (ek >= _bound_ref_direct_mh); |
1296 BasicType arg_type = ek_bound_mh_arg_type(ek); |
1297 BasicType arg_type = ek_bound_mh_arg_type(ek); |
1297 int arg_slots = type2size[arg_type]; |
1298 int arg_slots = type2size[arg_type]; |
1298 |
1299 |
1299 // make room for the new argument: |
1300 // make room for the new argument: |
1300 __ movl(rax_argslot, rcx_bmh_vmargslot); |
1301 __ movl(rax_argslot, rcx_bmh_vmargslot); |
1927 // Normal adjustment: ... keep1 | +dest+ | -collect- | keep2 | RF... | collect | |
1928 // Normal adjustment: ... keep1 | +dest+ | -collect- | keep2 | RF... | collect | |
1928 // If retaining args: ... keep1 | +dest+ | collect | keep2 | RF... | collect | |
1929 // If retaining args: ... keep1 | +dest+ | collect | keep2 | RF... | collect | |
1929 // In the non-retaining case, this might move keep2 either up or down. |
1930 // In the non-retaining case, this might move keep2 either up or down. |
1930 // We don't have to copy the whole | RF... collect | complex, |
1931 // We don't have to copy the whole | RF... collect | complex, |
1931 // but we must adjust RF.saved_args_base. |
1932 // but we must adjust RF.saved_args_base. |
1932 // Also, from now on, we will forget about the origial copy of |collect|. |
1933 // Also, from now on, we will forget about the original copy of |collect|. |
1933 // If we are retaining it, we will treat it as part of |keep2|. |
1934 // If we are retaining it, we will treat it as part of |keep2|. |
1934 // For clarity we will define |keep3| = |collect|keep2| or |keep2|. |
1935 // For clarity we will define |keep3| = |collect|keep2| or |keep2|. |
1935 |
1936 |
1936 BLOCK_COMMENT("adjust trailing arguments {"); |
1937 BLOCK_COMMENT("adjust trailing arguments {"); |
1937 // Compare the sizes of |+dest+| and |-collect-|, which are opposed opening and closing movements. |
1938 // Compare the sizes of |+dest+| and |-collect-|, which are opposed opening and closing movements. |
1984 |
1985 |
1985 // Old and new argument locations (based at slot 0). |
1986 // Old and new argument locations (based at slot 0). |
1986 // Net shift (&new_argv - &old_argv) is (close_count - open_count). |
1987 // Net shift (&new_argv - &old_argv) is (close_count - open_count). |
1987 bool zero_open_count = (open_count == 0); // remember this bit of info |
1988 bool zero_open_count = (open_count == 0); // remember this bit of info |
1988 if (move_keep3 && fix_arg_base) { |
1989 if (move_keep3 && fix_arg_base) { |
1989 // It will be easier t have everything in one register: |
1990 // It will be easier to have everything in one register: |
1990 if (close_count.is_register()) { |
1991 if (close_count.is_register()) { |
1991 // Deduct open_count from close_count register to get a clean +/- value. |
1992 // Deduct open_count from close_count register to get a clean +/- value. |
1992 __ subptr(close_count.as_register(), open_count); |
1993 __ subptr(close_count.as_register(), open_count); |
1993 } else { |
1994 } else { |
1994 close_count = close_count.as_constant() - open_count; |
1995 close_count = close_count.as_constant() - open_count; |