< prev index next >

src/hotspot/cpu/s390/c1_FrameMap_s390.cpp

Print this page
rev 56376 : 8231448: s390 and ppc - replace JVM type comparisons to T_OBJECT and T_ARRAY with call to is_reference_type
   1 /*
   2  * Copyright (c) 2016, 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  *


  29 #include "runtime/sharedRuntime.hpp"
  30 #include "vmreg_s390.inline.hpp"
  31 
  32 
  33 const int FrameMap::pd_c_runtime_reserved_arg_size = 7;
  34 
  35 LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) {
  36   LIR_Opr opr = LIR_OprFact::illegalOpr;
  37   VMReg r_1 = reg->first();
  38   VMReg r_2 = reg->second();
  39   if (r_1->is_stack()) {
  40     // Convert stack slot to an SP offset.
  41     // The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
  42     // so we must add it in here.
  43     int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
  44     opr = LIR_OprFact::address(new LIR_Address(Z_SP_opr, st_off, type));
  45   } else if (r_1->is_Register()) {
  46     Register reg = r_1->as_Register();
  47     if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
  48       opr = as_long_opr(reg);
  49     } else if (type == T_OBJECT || type == T_ARRAY) {
  50       opr = as_oop_opr(reg);
  51     } else if (type == T_METADATA) {
  52       opr = as_metadata_opr(reg);
  53     } else {
  54       opr = as_opr(reg);
  55     }
  56   } else if (r_1->is_FloatRegister()) {
  57     assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
  58     FloatRegister f = r_1->as_FloatRegister();
  59     if (type == T_FLOAT) {
  60       opr = as_float_opr(f);
  61     } else {
  62       opr = as_double_opr(f);
  63     }
  64   } else {
  65     ShouldNotReachHere();
  66   }
  67   return opr;
  68 }
  69 


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


  29 #include "runtime/sharedRuntime.hpp"
  30 #include "vmreg_s390.inline.hpp"
  31 
  32 
  33 const int FrameMap::pd_c_runtime_reserved_arg_size = 7;
  34 
  35 LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) {
  36   LIR_Opr opr = LIR_OprFact::illegalOpr;
  37   VMReg r_1 = reg->first();
  38   VMReg r_2 = reg->second();
  39   if (r_1->is_stack()) {
  40     // Convert stack slot to an SP offset.
  41     // The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
  42     // so we must add it in here.
  43     int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
  44     opr = LIR_OprFact::address(new LIR_Address(Z_SP_opr, st_off, type));
  45   } else if (r_1->is_Register()) {
  46     Register reg = r_1->as_Register();
  47     if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) {
  48       opr = as_long_opr(reg);
  49     } else if (is_reference_type(type)) {
  50       opr = as_oop_opr(reg);
  51     } else if (type == T_METADATA) {
  52       opr = as_metadata_opr(reg);
  53     } else {
  54       opr = as_opr(reg);
  55     }
  56   } else if (r_1->is_FloatRegister()) {
  57     assert(type == T_DOUBLE || type == T_FLOAT, "wrong type");
  58     FloatRegister f = r_1->as_FloatRegister();
  59     if (type == T_FLOAT) {
  60       opr = as_float_opr(f);
  61     } else {
  62       opr = as_double_opr(f);
  63     }
  64   } else {
  65     ShouldNotReachHere();
  66   }
  67   return opr;
  68 }
  69 


< prev index next >