< prev index next >

src/cpu/s390/vm/methodHandles_s390.cpp

Print this page


   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


 592       }
 593     }
 594 
 595     // Note: the unextended_sp may not be correct.
 596     tty->print_cr("  stack layout:");
 597     values.print(p);
 598     if (has_mh && mh->is_oop()) {
 599       mh->print();
 600       if (java_lang_invoke_MethodHandle::is_instance(mh)) {
 601         if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
 602           java_lang_invoke_MethodHandle::form(mh)->print();
 603         }
 604       }
 605     }
 606   }
 607 }
 608 
 609 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
 610   if (!TraceMethodHandles) { return; }
 611 



 612   BLOCK_COMMENT("trace_method_handle {");
 613 
 614   // Save argument registers (they are used in raise exception stub).
 615   __ z_stg(Z_ARG1, Address(Z_SP, 16));
 616   __ z_stg(Z_ARG2, Address(Z_SP, 24));
 617   __ z_stg(Z_ARG3, Address(Z_SP, 32));
 618   __ z_stg(Z_ARG4, Address(Z_SP, 40));
 619   __ z_stg(Z_ARG5, Address(Z_SP, 48));
 620 
 621   // Setup arguments.
 622   __ z_lgr(Z_ARG2, Z_ARG4); // mh, see generate_method_handle_interpreter_entry()
 623   __ z_lgr(Z_ARG3, Z_R10);  // sender_sp
 624   __ z_lgr(Z_ARG4, Z_esp);
 625   __ load_const_optimized(Z_ARG1, (void *)adaptername);
 626   __ z_lgr(Z_ARG5, Z_SP);   // tracing_fp
 627   __ save_return_pc();      // saves Z_R14
 628   __ push_frame_abi160(0);
 629   __ call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub));
 630   __ pop_frame();
 631   __ restore_return_pc();   // restores to Z_R14
 632   __ z_lg(Z_ARG1, Address(Z_SP, 16));
 633   __ z_lg(Z_ARG2, Address(Z_SP, 24));
 634   __ z_lg(Z_ARG3, Address(Z_SP, 32));
 635   __ z_lg(Z_ARG4, Address(Z_SP, 40));
 636   __ z_lg(Z_ARG5, Address(Z_SP, 45));
 637   __ zap_from_to(Z_SP, Z_SP, Z_R0, Z_R1, 50, -1);
 638   __ zap_from_to(Z_SP, Z_SP, Z_R0, Z_R1, -1, 5);
 639 
 640   BLOCK_COMMENT("} trace_method_handle");
 641 }
 642 #endif // !PRODUCT
   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016, 2017, SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


 592       }
 593     }
 594 
 595     // Note: the unextended_sp may not be correct.
 596     tty->print_cr("  stack layout:");
 597     values.print(p);
 598     if (has_mh && mh->is_oop()) {
 599       mh->print();
 600       if (java_lang_invoke_MethodHandle::is_instance(mh)) {
 601         if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
 602           java_lang_invoke_MethodHandle::form(mh)->print();
 603         }
 604       }
 605     }
 606   }
 607 }
 608 
 609 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
 610   if (!TraceMethodHandles) { return; }
 611 
 612   // If arg registers are contiguous, we can use STMG/LMG.
 613   assert((Z_ARG5->encoding() - Z_ARG1->encoding() + 1) == RegisterImpl::number_of_arg_registers, "Oops");
 614 
 615   BLOCK_COMMENT("trace_method_handle {");
 616 
 617   // Save argument registers (they are used in raise exception stub).
 618   // Argument registers have contiguous register numbers -> we can use stmg/lmg.
 619   __ z_stmg(Z_ARG1, Z_ARG5, 16, Z_SP);



 620 
 621   // Setup arguments.
 622   __ z_lgr(Z_ARG2, Z_ARG4); // mh, see generate_method_handle_interpreter_entry()
 623   __ z_lgr(Z_ARG3, Z_R10);  // sender_sp
 624   __ z_lgr(Z_ARG4, Z_esp);
 625   __ load_const_optimized(Z_ARG1, (void *)adaptername);
 626   __ z_lgr(Z_ARG5, Z_SP);   // tracing_fp
 627   __ save_return_pc();      // saves Z_R14
 628   __ push_frame_abi160(0);
 629   __ call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub));
 630   __ pop_frame();
 631   __ restore_return_pc();   // restores to Z_R14
 632 
 633   // Restore argument registers
 634   __ z_lmg(Z_ARG1, Z_ARG5, 16, Z_SP);


 635   __ zap_from_to(Z_SP, Z_SP, Z_R0, Z_R1, 50, -1);
 636   __ zap_from_to(Z_SP, Z_SP, Z_R0, Z_R1, -1, 5);
 637 
 638   BLOCK_COMMENT("} trace_method_handle");
 639 }
 640 #endif // !PRODUCT
< prev index next >