< prev index next >

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


 142   int i = 0;
 143   switch (type) {
 144     case T_BOOLEAN: i = 0; break;
 145     case T_CHAR   : i = 1; break;
 146     case T_BYTE   : i = 2; break;
 147     case T_SHORT  : i = 3; break;
 148     case T_INT    : i = 4; break;
 149     case T_LONG   : i = 5; break;
 150     case T_VOID   : i = 6; break;
 151     case T_FLOAT  : i = 7; break;
 152     case T_DOUBLE : i = 8; break;
 153     case T_OBJECT : i = 9; break;
 154     case T_ARRAY  : i = 9; break;
 155     default       : ShouldNotReachHere();
 156   }
 157   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
 158          "index out of bounds");
 159   return i;
 160 }
 161 #endif // _LP64
 162 
 163 // These should never be compiled since the interpreter will prefer
 164 // the compiled version to the intrinsic version.
 165 bool AbstractInterpreter::can_be_compiled(methodHandle m) {
 166   switch (method_kind(m)) {
 167     case Interpreter::java_lang_math_sin     : // fall thru
 168     case Interpreter::java_lang_math_cos     : // fall thru
 169     case Interpreter::java_lang_math_tan     : // fall thru
 170     case Interpreter::java_lang_math_abs     : // fall thru
 171     case Interpreter::java_lang_math_log     : // fall thru
 172     case Interpreter::java_lang_math_log10   : // fall thru
 173     case Interpreter::java_lang_math_sqrt    : // fall thru
 174     case Interpreter::java_lang_math_pow     : // fall thru
 175     case Interpreter::java_lang_math_exp     : // fall thru
 176     case Interpreter::java_lang_math_fmaD    : // fall thru
 177     case Interpreter::java_lang_math_fmaF    :
 178       return false;
 179     default:
 180       return true;
 181   }
 182 }
 183 
 184 // How much stack a method activation needs in words.
 185 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
 186   const int entry_size = frame::interpreter_frame_monitor_size();
 187 
 188   // total overhead size: entry_size + (saved rbp thru expr stack
 189   // bottom).  be sure to change this if you add/subtract anything
 190   // to/from the overhead area
 191   const int overhead_size =
 192     -(frame::interpreter_frame_initial_sp_offset) + entry_size;
 193 
 194 #ifndef _LP64
 195   const int stub_code = 4;  // see generate_call_stub
 196 #else
 197   const int stub_code = frame::entry_frame_after_call_words;
 198 #endif
 199 
 200   const int method_stack = (method->max_locals() + method->max_stack()) *
 201                            Interpreter::stackElementWords;
 202   return (overhead_size + method_stack + stub_code);
   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 142   int i = 0;
 143   switch (type) {
 144     case T_BOOLEAN: i = 0; break;
 145     case T_CHAR   : i = 1; break;
 146     case T_BYTE   : i = 2; break;
 147     case T_SHORT  : i = 3; break;
 148     case T_INT    : i = 4; break;
 149     case T_LONG   : i = 5; break;
 150     case T_VOID   : i = 6; break;
 151     case T_FLOAT  : i = 7; break;
 152     case T_DOUBLE : i = 8; break;
 153     case T_OBJECT : i = 9; break;
 154     case T_ARRAY  : i = 9; break;
 155     default       : ShouldNotReachHere();
 156   }
 157   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
 158          "index out of bounds");
 159   return i;
 160 }
 161 #endif // _LP64





















 162 
 163 // How much stack a method activation needs in words.
 164 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
 165   const int entry_size = frame::interpreter_frame_monitor_size();
 166 
 167   // total overhead size: entry_size + (saved rbp thru expr stack
 168   // bottom).  be sure to change this if you add/subtract anything
 169   // to/from the overhead area
 170   const int overhead_size =
 171     -(frame::interpreter_frame_initial_sp_offset) + entry_size;
 172 
 173 #ifndef _LP64
 174   const int stub_code = 4;  // see generate_call_stub
 175 #else
 176   const int stub_code = frame::entry_frame_after_call_words;
 177 #endif
 178 
 179   const int method_stack = (method->max_locals() + method->max_stack()) *
 180                            Interpreter::stackElementWords;
 181   return (overhead_size + method_stack + stub_code);
< prev index next >