< prev index next >

src/cpu/ppc/vm/abstractInterpreter_ppc.cpp

Print this page
rev 13183 : 8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled
Reviewed-by: coleenp, mdoerr, neliasso
   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2015 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.


  32 #include "utilities/macros.hpp"
  33 
  34 int AbstractInterpreter::BasicType_as_index(BasicType type) {
  35   int i = 0;
  36   switch (type) {
  37     case T_BOOLEAN: i = 0; break;
  38     case T_CHAR   : i = 1; break;
  39     case T_BYTE   : i = 2; break;
  40     case T_SHORT  : i = 3; break;
  41     case T_INT    : i = 4; break;
  42     case T_LONG   : i = 5; break;
  43     case T_VOID   : i = 6; break;
  44     case T_FLOAT  : i = 7; break;
  45     case T_DOUBLE : i = 8; break;
  46     case T_OBJECT : i = 9; break;
  47     case T_ARRAY  : i = 9; break;
  48     default       : ShouldNotReachHere();
  49   }
  50   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
  51   return i;
  52 }
  53 
  54 // These should never be compiled since the interpreter will prefer
  55 // the compiled version to the intrinsic version.
  56 bool AbstractInterpreter::can_be_compiled(methodHandle m) {
  57   switch (method_kind(m)) {
  58     case Interpreter::java_lang_math_sin     : // fall thru
  59     case Interpreter::java_lang_math_cos     : // fall thru
  60     case Interpreter::java_lang_math_tan     : // fall thru
  61     case Interpreter::java_lang_math_abs     : // fall thru
  62     case Interpreter::java_lang_math_log     : // fall thru
  63     case Interpreter::java_lang_math_log10   : // fall thru
  64     case Interpreter::java_lang_math_sqrt    : // fall thru
  65     case Interpreter::java_lang_math_pow     : // fall thru
  66     case Interpreter::java_lang_math_exp     : // fall thru
  67     case Interpreter::java_lang_math_fmaD    : // fall thru
  68     case Interpreter::java_lang_math_fmaF    :
  69       return false;
  70     default:
  71       return true;
  72   }
  73 }
  74 
  75 // How much stack a method activation needs in stack slots.
  76 // We must calc this exactly like in generate_fixed_frame.
  77 // Note: This returns the conservative size assuming maximum alignment.
  78 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
  79   const int max_alignment_size = 2;
  80   const int abi_scratch = frame::abi_reg_args_size;
  81   return method->max_locals() + method->max_stack() +
  82          frame::interpreter_frame_monitor_size() + max_alignment_size + abi_scratch;
  83 }
  84 
  85 // Returns number of stackElementWords needed for the interpreter frame with the
  86 // given sections.
  87 // This overestimates the stack by one slot in case of alignments.
  88 int AbstractInterpreter::size_activation(int max_stack,
  89                                          int temps,
  90                                          int extra_args,
  91                                          int monitors,
  92                                          int callee_params,


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


  32 #include "utilities/macros.hpp"
  33 
  34 int AbstractInterpreter::BasicType_as_index(BasicType type) {
  35   int i = 0;
  36   switch (type) {
  37     case T_BOOLEAN: i = 0; break;
  38     case T_CHAR   : i = 1; break;
  39     case T_BYTE   : i = 2; break;
  40     case T_SHORT  : i = 3; break;
  41     case T_INT    : i = 4; break;
  42     case T_LONG   : i = 5; break;
  43     case T_VOID   : i = 6; break;
  44     case T_FLOAT  : i = 7; break;
  45     case T_DOUBLE : i = 8; break;
  46     case T_OBJECT : i = 9; break;
  47     case T_ARRAY  : i = 9; break;
  48     default       : ShouldNotReachHere();
  49   }
  50   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
  51   return i;





















  52 }
  53 
  54 // How much stack a method activation needs in stack slots.
  55 // We must calc this exactly like in generate_fixed_frame.
  56 // Note: This returns the conservative size assuming maximum alignment.
  57 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
  58   const int max_alignment_size = 2;
  59   const int abi_scratch = frame::abi_reg_args_size;
  60   return method->max_locals() + method->max_stack() +
  61          frame::interpreter_frame_monitor_size() + max_alignment_size + abi_scratch;
  62 }
  63 
  64 // Returns number of stackElementWords needed for the interpreter frame with the
  65 // given sections.
  66 // This overestimates the stack by one slot in case of alignments.
  67 int AbstractInterpreter::size_activation(int max_stack,
  68                                          int temps,
  69                                          int extra_args,
  70                                          int monitors,
  71                                          int callee_params,


< prev index next >