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 *
23 */
24
25 class ciMethod;
26 class CallingConvention;
27 class BasicTypeArray;
28 class BasicTypeList;
29
30 //--------------------------------------------------------
31 // FrameMap
32 //--------------------------------------------------------
33
34 // This class is responsible of mapping items (locals, monitors, spill
35 // slots and registers to their frame location
36 //
37 // The monitors are specified by a consecutive index, although each monitor entry
38 // occupies two words. The monitor_index is 0.._num_monitors
39 // The spill index is similar to local index; it is in range 0..(open)
40 //
41 // The CPU registers are mapped using a fixed table; register with number 0
42 // is the most used one.
43
44
53
54 class LIR_OprDesc;
55 typedef LIR_OprDesc* LIR_Opr;
56
57
58 class FrameMap : public CompilationResourceObj {
59 public:
60 enum {
61 nof_cpu_regs = pd_nof_cpu_regs_frame_map,
62 nof_fpu_regs = pd_nof_fpu_regs_frame_map,
63
64 nof_cpu_regs_reg_alloc = pd_nof_cpu_regs_reg_alloc,
65 nof_fpu_regs_reg_alloc = pd_nof_fpu_regs_reg_alloc,
66
67 nof_caller_save_cpu_regs = pd_nof_caller_save_cpu_regs_frame_map,
68 nof_caller_save_fpu_regs = pd_nof_caller_save_fpu_regs_frame_map,
69
70 spill_slot_size_in_bytes = 4
71 };
72
73 # include "incls/_c1_FrameMap_pd.hpp.incl" // platform dependent declarations
74
75 friend class LIR_OprDesc;
76
77 private:
78 static bool _init_done;
79 static Register _cpu_rnr2reg [nof_cpu_regs];
80 static int _cpu_reg2rnr [nof_cpu_regs];
81
82 static LIR_Opr _caller_save_cpu_regs [nof_caller_save_cpu_regs];
83 static LIR_Opr _caller_save_fpu_regs [nof_caller_save_fpu_regs];
84
85 int _framesize;
86 int _argcount;
87 int _num_monitors;
88 int _num_spills;
89 int _reserved_argument_area_size;
90 int _oop_map_arg_count;
91
92 CallingConvention* _incoming_arguments;
93 intArray* _argument_locations;
249 CallingConvention (LIR_OprList* args, int reserved_stack_slots)
250 : _args(args)
251 , _reserved_stack_slots(reserved_stack_slots) {}
252
253 LIR_OprList* args() { return _args; }
254
255 LIR_Opr at(int i) const { return _args->at(i); }
256 int length() const { return _args->length(); }
257
258 // Indicates number of real frame slots used by arguments passed on stack.
259 int reserved_stack_slots() const { return _reserved_stack_slots; }
260
261 #ifndef PRODUCT
262 void print () const {
263 for (int i = 0; i < length(); i++) {
264 at(i)->print();
265 }
266 }
267 #endif // PRODUCT
268 };
|
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 *
23 */
24
25 #ifndef SHARE_VM_C1_C1_FRAMEMAP_HPP
26 #define SHARE_VM_C1_C1_FRAMEMAP_HPP
27
28 #include "asm/assembler.hpp"
29 #include "c1/c1_Defs.hpp"
30 #include "c1/c1_LIR.hpp"
31 #include "code/vmreg.hpp"
32 #include "memory/allocation.hpp"
33 #include "runtime/frame.hpp"
34 #include "runtime/synchronizer.hpp"
35 #include "utilities/globalDefinitions.hpp"
36
37 class ciMethod;
38 class CallingConvention;
39 class BasicTypeArray;
40 class BasicTypeList;
41
42 //--------------------------------------------------------
43 // FrameMap
44 //--------------------------------------------------------
45
46 // This class is responsible of mapping items (locals, monitors, spill
47 // slots and registers to their frame location
48 //
49 // The monitors are specified by a consecutive index, although each monitor entry
50 // occupies two words. The monitor_index is 0.._num_monitors
51 // The spill index is similar to local index; it is in range 0..(open)
52 //
53 // The CPU registers are mapped using a fixed table; register with number 0
54 // is the most used one.
55
56
65
66 class LIR_OprDesc;
67 typedef LIR_OprDesc* LIR_Opr;
68
69
70 class FrameMap : public CompilationResourceObj {
71 public:
72 enum {
73 nof_cpu_regs = pd_nof_cpu_regs_frame_map,
74 nof_fpu_regs = pd_nof_fpu_regs_frame_map,
75
76 nof_cpu_regs_reg_alloc = pd_nof_cpu_regs_reg_alloc,
77 nof_fpu_regs_reg_alloc = pd_nof_fpu_regs_reg_alloc,
78
79 nof_caller_save_cpu_regs = pd_nof_caller_save_cpu_regs_frame_map,
80 nof_caller_save_fpu_regs = pd_nof_caller_save_fpu_regs_frame_map,
81
82 spill_slot_size_in_bytes = 4
83 };
84
85 #ifdef TARGET_ARCH_x86
86 # include "c1_FrameMap_x86.hpp"
87 #endif
88 #ifdef TARGET_ARCH_sparc
89 # include "c1_FrameMap_sparc.hpp"
90 #endif
91
92
93 friend class LIR_OprDesc;
94
95 private:
96 static bool _init_done;
97 static Register _cpu_rnr2reg [nof_cpu_regs];
98 static int _cpu_reg2rnr [nof_cpu_regs];
99
100 static LIR_Opr _caller_save_cpu_regs [nof_caller_save_cpu_regs];
101 static LIR_Opr _caller_save_fpu_regs [nof_caller_save_fpu_regs];
102
103 int _framesize;
104 int _argcount;
105 int _num_monitors;
106 int _num_spills;
107 int _reserved_argument_area_size;
108 int _oop_map_arg_count;
109
110 CallingConvention* _incoming_arguments;
111 intArray* _argument_locations;
267 CallingConvention (LIR_OprList* args, int reserved_stack_slots)
268 : _args(args)
269 , _reserved_stack_slots(reserved_stack_slots) {}
270
271 LIR_OprList* args() { return _args; }
272
273 LIR_Opr at(int i) const { return _args->at(i); }
274 int length() const { return _args->length(); }
275
276 // Indicates number of real frame slots used by arguments passed on stack.
277 int reserved_stack_slots() const { return _reserved_stack_slots; }
278
279 #ifndef PRODUCT
280 void print () const {
281 for (int i = 0; i < length(); i++) {
282 at(i)->print();
283 }
284 }
285 #endif // PRODUCT
286 };
287
288 #endif // SHARE_VM_C1_C1_FRAMEMAP_HPP
|