< prev index next >

src/hotspot/cpu/s390/methodHandles_s390.cpp

Print this page

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






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



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

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



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