1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. 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.
34
35 int AbstractInterpreter::BasicType_as_index(BasicType type) {
36 int i = 0;
37 switch (type) {
38 case T_BOOLEAN: i = 0; break;
39 case T_CHAR : i = 1; break;
40 case T_BYTE : i = 2; break;
41 case T_SHORT : i = 3; break;
42 case T_INT : i = 4; break;
43 case T_LONG : i = 5; break;
44 case T_VOID : i = 6; break;
45 case T_FLOAT : i = 7; break;
46 case T_DOUBLE : i = 8; break;
47 case T_OBJECT : i = 9; break;
48 case T_ARRAY : i = 9; break;
49 default : ShouldNotReachHere();
50 }
51 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
52 "index out of bounds");
53 return i;
54 }
55
56 // These should never be compiled since the interpreter will prefer
57 // the compiled version to the intrinsic version.
58 bool AbstractInterpreter::can_be_compiled(methodHandle m) {
59 switch (method_kind(m)) {
60 case Interpreter::java_lang_math_sin : // fall thru
61 case Interpreter::java_lang_math_cos : // fall thru
62 case Interpreter::java_lang_math_tan : // fall thru
63 case Interpreter::java_lang_math_abs : // fall thru
64 case Interpreter::java_lang_math_log : // fall thru
65 case Interpreter::java_lang_math_log10 : // fall thru
66 case Interpreter::java_lang_math_sqrt : // fall thru
67 case Interpreter::java_lang_math_pow : // fall thru
68 case Interpreter::java_lang_math_exp : // fall thru
69 case Interpreter::java_lang_math_fmaD : // fall thru
70 case Interpreter::java_lang_math_fmaF :
71 return false;
72 default:
73 return true;
74 }
75 }
76
77 // How much stack a method activation needs in words.
78 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
79 const int entry_size = frame::interpreter_frame_monitor_size();
80
81 // total overhead size: entry_size + (saved rfp thru expr stack
82 // bottom). be sure to change this if you add/subtract anything
83 // to/from the overhead area
84 const int overhead_size =
85 -(frame::interpreter_frame_initial_sp_offset) + entry_size;
86
87 const int stub_code = frame::entry_frame_after_call_words;
88 const int method_stack = (method->max_locals() + method->max_stack()) *
89 Interpreter::stackElementWords;
90 return (overhead_size + method_stack + stub_code);
91 }
92
93 // asm based interpreter deoptimization helpers
94 int AbstractInterpreter::size_activation(int max_stack,
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. 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.
34
35 int AbstractInterpreter::BasicType_as_index(BasicType type) {
36 int i = 0;
37 switch (type) {
38 case T_BOOLEAN: i = 0; break;
39 case T_CHAR : i = 1; break;
40 case T_BYTE : i = 2; break;
41 case T_SHORT : i = 3; break;
42 case T_INT : i = 4; break;
43 case T_LONG : i = 5; break;
44 case T_VOID : i = 6; break;
45 case T_FLOAT : i = 7; break;
46 case T_DOUBLE : i = 8; break;
47 case T_OBJECT : i = 9; break;
48 case T_ARRAY : i = 9; break;
49 default : ShouldNotReachHere();
50 }
51 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
52 "index out of bounds");
53 return i;
54 }
55
56 // How much stack a method activation needs in words.
57 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
58 const int entry_size = frame::interpreter_frame_monitor_size();
59
60 // total overhead size: entry_size + (saved rfp thru expr stack
61 // bottom). be sure to change this if you add/subtract anything
62 // to/from the overhead area
63 const int overhead_size =
64 -(frame::interpreter_frame_initial_sp_offset) + entry_size;
65
66 const int stub_code = frame::entry_frame_after_call_words;
67 const int method_stack = (method->max_locals() + method->max_stack()) *
68 Interpreter::stackElementWords;
69 return (overhead_size + method_stack + stub_code);
70 }
71
72 // asm based interpreter deoptimization helpers
73 int AbstractInterpreter::size_activation(int max_stack,
|