< prev index next >

src/hotspot/cpu/s390/methodHandles_s390.cpp

Print this page

332     // Adjust argument list by popping the trailing MemberName argument.
333     Register Z_recv = noreg;
334 
335     if (MethodHandles::ref_kind_has_receiver(ref_kind)) {
336       // Load the receiver (not the MH; the actual MemberName's receiver)
337       // up from the interpreter stack.
338       __ z_lg(Z_recv = Z_R5, Z_R4_first_arg_addr);
339       DEBUG_ONLY(Z_R4_param_size = noreg);
340     }
341 
342     Register Z_member = Z_method;  // MemberName ptr; incoming method ptr is dead now
343 
344     __ z_lg(Z_member, __ argument_address(constant(1)));
345     __ add2reg(Z_esp, Interpreter::stackElementSize);
346     generate_method_handle_dispatch(_masm, iid, Z_recv, Z_member, not_for_compiler_entry);
347   }
348 
349   return entry_point;
350 }
351 






352 void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
353                                                     vmIntrinsics::ID iid,
354                                                     Register receiver_reg,
355                                                     Register member_reg,
356                                                     bool for_compiler_entry) {
357   assert(is_signature_polymorphic(iid), "expected invoke iid");
358 
359   Register temp1 = for_compiler_entry ? Z_R10 : Z_R6;
360   Register temp2 = Z_R12;
361   Register temp3 = Z_R11;
362   Register temp4 = Z_R13;
363 
364   if (for_compiler_entry) {
365     assert(receiver_reg == (iid == vmIntrinsics::_linkToStatic ? noreg : Z_ARG1),
366            "only valid assignment");
367   }
368   if (receiver_reg != noreg) {
369     assert_different_registers(temp1, temp2, temp3, temp4, receiver_reg);
370   }
371   if (member_reg != noreg) {
372     assert_different_registers(temp1, temp2, temp3, temp4, member_reg);
373   }
374   if (!for_compiler_entry) {  // Don't trash last SP.
375     assert_different_registers(temp1, temp2, temp3, temp4, Z_R10);
376   }
377 
378   if (iid == vmIntrinsics::_invokeBasic || iid == vmIntrinsics::_linkToNative) {
379     if (iid == vmIntrinsics::_linkToNative) {
380       assert(for_compiler_entry, "only compiler entry is supported");
381     }
382     __ pc(); // Just for the block comment.
383     // Indirect through MH.form.vmentry.vmtarget.
384     jump_to_lambda_form(_masm, receiver_reg, Z_method, Z_R1, temp3, for_compiler_entry);
385     return;



386   }
387 
388   // The method is a member invoker used by direct method handles.
389   if (VerifyMethodHandles) {
390     // Make sure the trailing argument really is a MemberName (caller responsibility).
391     verify_klass(_masm, member_reg,
392                  VM_CLASS_ID(MemberName_klass),
393                  temp1, temp2,
394                  "MemberName required for invokeVirtual etc.");
395   }
396 
397   Address  member_clazz(   member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
398   Address  member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
399   Address  member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
400   Address  vmtarget_method(Z_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
401   Register temp1_recv_klass = temp1;
402 
403   if (iid != vmIntrinsics::_linkToStatic) {
404     __ verify_oop(receiver_reg, FILE_AND_LINE);
405     if (iid == vmIntrinsics::_linkToSpecial) {

332     // Adjust argument list by popping the trailing MemberName argument.
333     Register Z_recv = noreg;
334 
335     if (MethodHandles::ref_kind_has_receiver(ref_kind)) {
336       // Load the receiver (not the MH; the actual MemberName's receiver)
337       // up from the interpreter stack.
338       __ z_lg(Z_recv = Z_R5, Z_R4_first_arg_addr);
339       DEBUG_ONLY(Z_R4_param_size = noreg);
340     }
341 
342     Register Z_member = Z_method;  // MemberName ptr; incoming method ptr is dead now
343 
344     __ z_lg(Z_member, __ argument_address(constant(1)));
345     __ add2reg(Z_esp, Interpreter::stackElementSize);
346     generate_method_handle_dispatch(_masm, iid, Z_recv, Z_member, not_for_compiler_entry);
347   }
348 
349   return entry_point;
350 }
351 
352 void MethodHandles::jump_to_native_invoker(MacroAssembler* _masm, Register nep_reg, Register temp_target) {
353   BLOCK_COMMENT("jump_to_native_invoker {");
354   __ should_not_reach_here();
355   BLOCK_COMMENT("} jump_to_native_invoker");
356 }
357 
358 void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
359                                                     vmIntrinsics::ID iid,
360                                                     Register receiver_reg,
361                                                     Register member_reg,
362                                                     bool for_compiler_entry) {
363   assert(is_signature_polymorphic(iid), "expected invoke iid");
364 
365   Register temp1 = for_compiler_entry ? Z_R10 : Z_R6;
366   Register temp2 = Z_R12;
367   Register temp3 = Z_R11;
368   Register temp4 = Z_R13;
369 
370   if (for_compiler_entry) {
371     assert(receiver_reg == (iid == vmIntrinsics::_linkToStatic || iid == vmIntrinsics::_linkToNative ? noreg : Z_ARG1),
372            "only valid assignment");
373   }
374   if (receiver_reg != noreg) {
375     assert_different_registers(temp1, temp2, temp3, temp4, receiver_reg);
376   }
377   if (member_reg != noreg) {
378     assert_different_registers(temp1, temp2, temp3, temp4, member_reg);
379   }
380   if (!for_compiler_entry) {  // Don't trash last SP.
381     assert_different_registers(temp1, temp2, temp3, temp4, Z_R10);
382   }
383 
384   if (iid == vmIntrinsics::_invokeBasic) {



385     __ pc(); // Just for the block comment.
386     // Indirect through MH.form.vmentry.vmtarget.
387     jump_to_lambda_form(_masm, receiver_reg, Z_method, Z_R1, temp3, for_compiler_entry);
388     return;
389   } else if (iid == vmIntrinsics::_linkToNative) {
390     assert(for_compiler_entry, "only compiler entry is supported");
391     jump_to_native_invoker(_masm, member_reg, temp1);
392   }
393 
394   // The method is a member invoker used by direct method handles.
395   if (VerifyMethodHandles) {
396     // Make sure the trailing argument really is a MemberName (caller responsibility).
397     verify_klass(_masm, member_reg,
398                  VM_CLASS_ID(MemberName_klass),
399                  temp1, temp2,
400                  "MemberName required for invokeVirtual etc.");
401   }
402 
403   Address  member_clazz(   member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
404   Address  member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
405   Address  member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
406   Address  vmtarget_method(Z_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
407   Register temp1_recv_klass = temp1;
408 
409   if (iid != vmIntrinsics::_linkToStatic) {
410     __ verify_oop(receiver_reg, FILE_AND_LINE);
411     if (iid == vmIntrinsics::_linkToSpecial) {
< prev index next >