< prev index next >

src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp

Print this page

   1 /*
   2  * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016, 2024 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.

 760   LIRItem value(x->value(), this);
 761 
 762   value.load_item();
 763   LIR_Opr reg = rlock_result(x);
 764   __ convert(x->op(), value.result(), reg);
 765 }
 766 
 767 void LIRGenerator::do_NewInstance(NewInstance* x) {
 768   print_if_not_loaded(x);
 769 
 770   // This instruction can be deoptimized in the slow path : use
 771   // Z_R2 as result register.
 772   const LIR_Opr reg = result_register_for (x->type());
 773 
 774   CodeEmitInfo* info = state_for (x, x->state());
 775   LIR_Opr tmp1 = FrameMap::Z_R12_oop_opr;
 776   LIR_Opr tmp2 = FrameMap::Z_R13_oop_opr;
 777   LIR_Opr tmp3 = reg;
 778   LIR_Opr tmp4 = LIR_OprFact::illegalOpr;
 779   LIR_Opr klass_reg = FrameMap::Z_R11_metadata_opr;
 780   new_instance(reg, x->klass(), x->is_unresolved(), tmp1, tmp2, tmp3, tmp4, klass_reg, info);
 781   LIR_Opr result = rlock_result(x);
 782   __ move(reg, result);
 783 }
 784 
 785 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
 786   CodeEmitInfo* info = nullptr;
 787   if (x->state_before() != nullptr && x->state_before()->force_reexecute()) {
 788     info = state_for(x, x->state_before());
 789     info->set_force_reexecute();
 790   } else {
 791     info = state_for(x, x->state());
 792   }
 793 
 794   LIRItem length(x->length(), this);
 795   length.load_item();
 796 
 797   LIR_Opr reg = result_register_for (x->type());
 798   LIR_Opr tmp1 = FrameMap::Z_R12_oop_opr;
 799   LIR_Opr tmp2 = FrameMap::Z_R13_oop_opr;
 800   LIR_Opr tmp3 = reg;

 920 
 921   CodeStub* stub;
 922   if (x->is_incompatible_class_change_check()) {
 923     assert(patching_info == nullptr, "can't patch this");
 924     stub = new SimpleExceptionStub(StubId::c1_throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
 925   } else if (x->is_invokespecial_receiver_check()) {
 926     assert(patching_info == nullptr, "can't patch this");
 927     stub = new DeoptimizeStub(info_for_exception,
 928                               Deoptimization::Reason_class_check,
 929                               Deoptimization::Action_none);
 930   } else {
 931     stub = new SimpleExceptionStub(StubId::c1_throw_class_cast_exception_id, obj.result(), info_for_exception);
 932   }
 933   LIR_Opr reg = rlock_result(x);
 934   LIR_Opr tmp1 = new_register(objectType);
 935   LIR_Opr tmp2 = new_register(objectType);
 936   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
 937   __ checkcast(reg, obj.result(), x->klass(),
 938                tmp1, tmp2, tmp3,
 939                x->direct_compare(), info_for_exception, patching_info, stub,
 940                x->profiled_method(), x->profiled_bci());
 941 }
 942 
 943 
 944 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
 945   LIRItem obj(x->obj(), this);
 946   CodeEmitInfo* patching_info = nullptr;
 947   if (!x->klass()->is_loaded() || PatchALot) {
 948     patching_info = state_for (x, x->state_before());
 949   }
 950   // Ensure the result register is not the input register because the
 951   // result is initialized before the patching safepoint.
 952   obj.load_item();
 953   LIR_Opr out_reg = rlock_result(x);
 954   LIR_Opr tmp1 = new_register(objectType);
 955   LIR_Opr tmp2 = new_register(objectType);
 956   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
 957   __ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,
 958                 x->direct_compare(), patching_info,
 959                 x->profiled_method(), x->profiled_bci());
 960 }

   1 /*
   2  * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016, 2024 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.

 760   LIRItem value(x->value(), this);
 761 
 762   value.load_item();
 763   LIR_Opr reg = rlock_result(x);
 764   __ convert(x->op(), value.result(), reg);
 765 }
 766 
 767 void LIRGenerator::do_NewInstance(NewInstance* x) {
 768   print_if_not_loaded(x);
 769 
 770   // This instruction can be deoptimized in the slow path : use
 771   // Z_R2 as result register.
 772   const LIR_Opr reg = result_register_for (x->type());
 773 
 774   CodeEmitInfo* info = state_for (x, x->state());
 775   LIR_Opr tmp1 = FrameMap::Z_R12_oop_opr;
 776   LIR_Opr tmp2 = FrameMap::Z_R13_oop_opr;
 777   LIR_Opr tmp3 = reg;
 778   LIR_Opr tmp4 = LIR_OprFact::illegalOpr;
 779   LIR_Opr klass_reg = FrameMap::Z_R11_metadata_opr;
 780   new_instance(reg, x->klass(), x->is_unresolved(), /* allow_inline */ false, tmp1, tmp2, tmp3, tmp4, klass_reg, info);
 781   LIR_Opr result = rlock_result(x);
 782   __ move(reg, result);
 783 }
 784 
 785 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
 786   CodeEmitInfo* info = nullptr;
 787   if (x->state_before() != nullptr && x->state_before()->force_reexecute()) {
 788     info = state_for(x, x->state_before());
 789     info->set_force_reexecute();
 790   } else {
 791     info = state_for(x, x->state());
 792   }
 793 
 794   LIRItem length(x->length(), this);
 795   length.load_item();
 796 
 797   LIR_Opr reg = result_register_for (x->type());
 798   LIR_Opr tmp1 = FrameMap::Z_R12_oop_opr;
 799   LIR_Opr tmp2 = FrameMap::Z_R13_oop_opr;
 800   LIR_Opr tmp3 = reg;

 920 
 921   CodeStub* stub;
 922   if (x->is_incompatible_class_change_check()) {
 923     assert(patching_info == nullptr, "can't patch this");
 924     stub = new SimpleExceptionStub(StubId::c1_throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
 925   } else if (x->is_invokespecial_receiver_check()) {
 926     assert(patching_info == nullptr, "can't patch this");
 927     stub = new DeoptimizeStub(info_for_exception,
 928                               Deoptimization::Reason_class_check,
 929                               Deoptimization::Action_none);
 930   } else {
 931     stub = new SimpleExceptionStub(StubId::c1_throw_class_cast_exception_id, obj.result(), info_for_exception);
 932   }
 933   LIR_Opr reg = rlock_result(x);
 934   LIR_Opr tmp1 = new_register(objectType);
 935   LIR_Opr tmp2 = new_register(objectType);
 936   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
 937   __ checkcast(reg, obj.result(), x->klass(),
 938                tmp1, tmp2, tmp3,
 939                x->direct_compare(), info_for_exception, patching_info, stub,
 940                x->profiled_method(), x->profiled_bci(), /*is_null_free*/ false);
 941 }
 942 
 943 
 944 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
 945   LIRItem obj(x->obj(), this);
 946   CodeEmitInfo* patching_info = nullptr;
 947   if (!x->klass()->is_loaded() || PatchALot) {
 948     patching_info = state_for (x, x->state_before());
 949   }
 950   // Ensure the result register is not the input register because the
 951   // result is initialized before the patching safepoint.
 952   obj.load_item();
 953   LIR_Opr out_reg = rlock_result(x);
 954   LIR_Opr tmp1 = new_register(objectType);
 955   LIR_Opr tmp2 = new_register(objectType);
 956   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
 957   __ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,
 958                 x->direct_compare(), patching_info,
 959                 x->profiled_method(), x->profiled_bci());
 960 }
< prev index next >