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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/interpreter.hpp"
27 #include "interpreter/interpreterGenerator.hpp"
28 #include "oops/constMethod.hpp"
29 #include "oops/method.hpp"
30 #include "runtime/arguments.hpp"
31 #include "runtime/frame.inline.hpp"
32 #include "runtime/synchronizer.hpp"
33 #include "utilities/macros.hpp"
34
35
36 int AbstractInterpreter::BasicType_as_index(BasicType type) {
37 int i = 0;
38 switch (type) {
39 case T_BOOLEAN: i = 0; break;
40 case T_CHAR : i = 1; break;
41 case T_BYTE : i = 2; break;
42 case T_SHORT : i = 3; break;
43 case T_INT : i = 4; break;
44 case T_LONG : i = 5; break;
45 case T_VOID : i = 6; break;
46 case T_FLOAT : i = 7; break;
47 case T_DOUBLE : i = 8; break;
48 case T_OBJECT : i = 9; break;
49 case T_ARRAY : i = 9; break;
50 default : ShouldNotReachHere();
51 }
52 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
53 return i;
54 }
90 // See call_stub code
91 int call_stub_size = round_to(7 + frame::memory_parameter_word_sp_offset,
92 WordsPerLong); // 7 + register save area
93
94 // Save space for one monitor to get into the interpreted method in case
95 // the method is synchronized
96 int monitor_size = method->is_synchronized() ?
97 1*frame::interpreter_frame_monitor_size() : 0;
98 return size_activation_helper(method->max_locals(), method->max_stack(),
99 monitor_size) + call_stub_size;
100 }
101
102 int AbstractInterpreter::size_activation(int max_stack,
103 int temps,
104 int extra_args,
105 int monitors,
106 int callee_params,
107 int callee_locals,
108 bool is_top_frame) {
109 // Note: This calculation must exactly parallel the frame setup
110 // in InterpreterGenerator::generate_fixed_frame.
111
112 int monitor_size = monitors * frame::interpreter_frame_monitor_size();
113
114 assert(monitor_size == round_to(monitor_size, WordsPerLong), "must align");
115
116 //
117 // Note: if you look closely this appears to be doing something much different
118 // than generate_fixed_frame. What is happening is this. On sparc we have to do
119 // this dance with interpreter_sp_adjustment because the window save area would
120 // appear just below the bottom (tos) of the caller's java expression stack. Because
121 // the interpreter want to have the locals completely contiguous generate_fixed_frame
122 // will adjust the caller's sp for the "extra locals" (max_locals - parameter_size).
123 // Now in generate_fixed_frame the extension of the caller's sp happens in the callee.
124 // In this code the opposite occurs the caller adjusts it's own stack base on the callee.
125 // This is mostly ok but it does cause a problem when we get to the initial frame (the oldest)
126 // because the oldest frame would have adjust its callers frame and yet that frame
127 // already exists and isn't part of this array of frames we are unpacking. So at first
128 // glance this would seem to mess up that frame. However Deoptimization::fetch_unroll_info_helper()
129 // will after it calculates all of the frame's on_stack_size()'s will then figure out the
130 // amount to adjust the caller of the initial (oldest) frame and the calculation will all
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/interpreter.hpp"
27 #include "oops/constMethod.hpp"
28 #include "oops/method.hpp"
29 #include "runtime/arguments.hpp"
30 #include "runtime/frame.inline.hpp"
31 #include "runtime/synchronizer.hpp"
32 #include "utilities/macros.hpp"
33
34 // Size of interpreter code. Increase if too small. Interpreter will
35 // fail with a guarantee ("not enough space for interpreter generation");
36 // if too small.
37 // Run with +PrintInterpreter to get the VM to print out the size.
38 // Max size with JVMTI
39 #ifdef _LP64
40 // The sethi() instruction generates lots more instructions when shell
41 // stack limit is unlimited, so that's why this is much bigger.
42 int TemplateInterpreter::InterpreterCodeSize = 260 * K;
43 #else
44 int TemplateInterpreter::InterpreterCodeSize = 230 * K;
45 #endif
46
47 int AbstractInterpreter::BasicType_as_index(BasicType type) {
48 int i = 0;
49 switch (type) {
50 case T_BOOLEAN: i = 0; break;
51 case T_CHAR : i = 1; break;
52 case T_BYTE : i = 2; break;
53 case T_SHORT : i = 3; break;
54 case T_INT : i = 4; break;
55 case T_LONG : i = 5; break;
56 case T_VOID : i = 6; break;
57 case T_FLOAT : i = 7; break;
58 case T_DOUBLE : i = 8; break;
59 case T_OBJECT : i = 9; break;
60 case T_ARRAY : i = 9; break;
61 default : ShouldNotReachHere();
62 }
63 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
64 return i;
65 }
101 // See call_stub code
102 int call_stub_size = round_to(7 + frame::memory_parameter_word_sp_offset,
103 WordsPerLong); // 7 + register save area
104
105 // Save space for one monitor to get into the interpreted method in case
106 // the method is synchronized
107 int monitor_size = method->is_synchronized() ?
108 1*frame::interpreter_frame_monitor_size() : 0;
109 return size_activation_helper(method->max_locals(), method->max_stack(),
110 monitor_size) + call_stub_size;
111 }
112
113 int AbstractInterpreter::size_activation(int max_stack,
114 int temps,
115 int extra_args,
116 int monitors,
117 int callee_params,
118 int callee_locals,
119 bool is_top_frame) {
120 // Note: This calculation must exactly parallel the frame setup
121 // in TemplateInterpreterGenerator::generate_fixed_frame.
122
123 int monitor_size = monitors * frame::interpreter_frame_monitor_size();
124
125 assert(monitor_size == round_to(monitor_size, WordsPerLong), "must align");
126
127 //
128 // Note: if you look closely this appears to be doing something much different
129 // than generate_fixed_frame. What is happening is this. On sparc we have to do
130 // this dance with interpreter_sp_adjustment because the window save area would
131 // appear just below the bottom (tos) of the caller's java expression stack. Because
132 // the interpreter want to have the locals completely contiguous generate_fixed_frame
133 // will adjust the caller's sp for the "extra locals" (max_locals - parameter_size).
134 // Now in generate_fixed_frame the extension of the caller's sp happens in the callee.
135 // In this code the opposite occurs the caller adjusts it's own stack base on the callee.
136 // This is mostly ok but it does cause a problem when we get to the initial frame (the oldest)
137 // because the oldest frame would have adjust its callers frame and yet that frame
138 // already exists and isn't part of this array of frames we are unpacking. So at first
139 // glance this would seem to mess up that frame. However Deoptimization::fetch_unroll_info_helper()
140 // will after it calculates all of the frame's on_stack_size()'s will then figure out the
141 // amount to adjust the caller of the initial (oldest) frame and the calculation will all
|