Mercurial > hg > graal-compiler
comparison src/cpu/ppc/vm/frame_ppc.hpp @ 14726:92aa6797d639
Backed out merge changeset: b51e29501f30
Backed out merge revision to its first parent (8f483e200405)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 24 Mar 2014 21:30:43 +0100 |
parents | 58cf34613a72 |
children |
comparison
equal
deleted
inserted
replaced
14719:0bdd0d157040 | 14726:92aa6797d639 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. | 3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 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 | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
27 #define CPU_PPC_VM_FRAME_PPC_HPP | 27 #define CPU_PPC_VM_FRAME_PPC_HPP |
28 | 28 |
29 #include "runtime/synchronizer.hpp" | 29 #include "runtime/synchronizer.hpp" |
30 #include "utilities/top.hpp" | 30 #include "utilities/top.hpp" |
31 | 31 |
32 #ifndef CC_INTERP | |
33 #error "CC_INTERP must be defined on PPC64" | |
34 #endif | |
35 | |
32 // C frame layout on PPC-64. | 36 // C frame layout on PPC-64. |
33 // | 37 // |
34 // In this figure the stack grows upwards, while memory grows | 38 // In this figure the stack grows upwards, while memory grows |
35 // downwards. See "64-bit PowerPC ELF ABI Supplement Version 1.7", | 39 // downwards. See "64-bit PowerPC ELF ABI Supplement Version 1.7", |
36 // IBM Corp. (2003-10-29) | 40 // IBM Corp. (2003-10-29) |
44 // [C_FRAME] <-- SP before prolog | 48 // [C_FRAME] <-- SP before prolog |
45 // ... | 49 // ... |
46 // [C_FRAME] | 50 // [C_FRAME] |
47 // | 51 // |
48 // C_FRAME: | 52 // C_FRAME: |
49 // 0 [ABI_REG_ARGS] | 53 // 0 [ABI_112] |
50 // 112 CARG_9: outgoing arg 9 (arg_1 ... arg_8 via gpr_3 ... gpr_{10}) | 54 // 112 CARG_9: outgoing arg 9 (arg_1 ... arg_8 via gpr_3 ... gpr_{10}) |
51 // ... | 55 // ... |
52 // 40+M*8 CARG_M: outgoing arg M (M is the maximum of outgoing args taken over all call sites in the procedure) | 56 // 40+M*8 CARG_M: outgoing arg M (M is the maximum of outgoing args taken over all call sites in the procedure) |
53 // local 1 | 57 // local 1 |
54 // ... | 58 // ... |
71 // 16 space for link register (LR) for next call | 75 // 16 space for link register (LR) for next call |
72 // 24 reserved | 76 // 24 reserved |
73 // 32 reserved | 77 // 32 reserved |
74 // 40 space for TOC (=R2) register for next call | 78 // 40 space for TOC (=R2) register for next call |
75 // | 79 // |
76 // ABI_REG_ARGS: | 80 // ABI_112: |
77 // 0 [ABI_48] | 81 // 0 [ABI_48] |
78 // 48 CARG_1: spill slot for outgoing arg 1. used by next callee. | 82 // 48 CARG_1: spill slot for outgoing arg 1. used by next callee. |
79 // ... ... | 83 // ... ... |
80 // 104 CARG_8: spill slot for outgoing arg 8. used by next callee. | 84 // 104 CARG_8: spill slot for outgoing arg 8. used by next callee. |
81 // | 85 // |
89 alignment_in_bytes = 16, | 93 alignment_in_bytes = 16, |
90 // log_2(16*8 bits) = 7. | 94 // log_2(16*8 bits) = 7. |
91 log_2_of_alignment_in_bits = 7 | 95 log_2_of_alignment_in_bits = 7 |
92 }; | 96 }; |
93 | 97 |
94 // ABI_MINFRAME: | 98 // ABI_48: |
95 struct abi_minframe { | 99 struct abi_48 { |
96 uint64_t callers_sp; | 100 uint64_t callers_sp; |
97 uint64_t cr; //_16 | 101 uint64_t cr; //_16 |
98 uint64_t lr; | 102 uint64_t lr; |
99 #if !defined(ABI_ELFv2) | |
100 uint64_t reserved1; //_16 | 103 uint64_t reserved1; //_16 |
101 uint64_t reserved2; | 104 uint64_t reserved2; |
102 #endif | |
103 uint64_t toc; //_16 | 105 uint64_t toc; //_16 |
104 // nothing to add here! | 106 // nothing to add here! |
105 // aligned to frame::alignment_in_bytes (16) | 107 // aligned to frame::alignment_in_bytes (16) |
106 }; | 108 }; |
107 | 109 |
108 enum { | 110 enum { |
109 abi_minframe_size = sizeof(abi_minframe) | 111 abi_48_size = sizeof(abi_48) |
110 }; | 112 }; |
111 | 113 |
112 struct abi_reg_args : abi_minframe { | 114 struct abi_112 : abi_48 { |
113 uint64_t carg_1; | 115 uint64_t carg_1; |
114 uint64_t carg_2; //_16 | 116 uint64_t carg_2; //_16 |
115 uint64_t carg_3; | 117 uint64_t carg_3; |
116 uint64_t carg_4; //_16 | 118 uint64_t carg_4; //_16 |
117 uint64_t carg_5; | 119 uint64_t carg_5; |
120 uint64_t carg_8; //_16 | 122 uint64_t carg_8; //_16 |
121 // aligned to frame::alignment_in_bytes (16) | 123 // aligned to frame::alignment_in_bytes (16) |
122 }; | 124 }; |
123 | 125 |
124 enum { | 126 enum { |
125 abi_reg_args_size = sizeof(abi_reg_args) | 127 abi_112_size = sizeof(abi_112) |
126 }; | 128 }; |
127 | 129 |
128 #define _abi(_component) \ | 130 #define _abi(_component) \ |
129 (offset_of(frame::abi_reg_args, _component)) | 131 (offset_of(frame::abi_112, _component)) |
130 | 132 |
131 struct abi_reg_args_spill : abi_reg_args { | 133 struct abi_112_spill : abi_112 { |
132 // additional spill slots | 134 // additional spill slots |
133 uint64_t spill_ret; | 135 uint64_t spill_ret; |
134 uint64_t spill_fret; //_16 | 136 uint64_t spill_fret; //_16 |
135 // aligned to frame::alignment_in_bytes (16) | 137 // aligned to frame::alignment_in_bytes (16) |
136 }; | 138 }; |
137 | 139 |
138 enum { | 140 enum { |
139 abi_reg_args_spill_size = sizeof(abi_reg_args_spill) | 141 abi_112_spill_size = sizeof(abi_112_spill) |
140 }; | 142 }; |
141 | 143 |
142 #define _abi_reg_args_spill(_component) \ | 144 #define _abi_112_spill(_component) \ |
143 (offset_of(frame::abi_reg_args_spill, _component)) | 145 (offset_of(frame::abi_112_spill, _component)) |
144 | 146 |
145 // non-volatile GPRs: | 147 // non-volatile GPRs: |
146 | 148 |
147 struct spill_nonvolatiles { | 149 struct spill_nonvolatiles { |
148 uint64_t r14; | 150 uint64_t r14; |
191 }; | 193 }; |
192 | 194 |
193 #define _spill_nonvolatiles_neg(_component) \ | 195 #define _spill_nonvolatiles_neg(_component) \ |
194 (int)(-frame::spill_nonvolatiles_size + offset_of(frame::spill_nonvolatiles, _component)) | 196 (int)(-frame::spill_nonvolatiles_size + offset_of(frame::spill_nonvolatiles, _component)) |
195 | 197 |
196 | 198 // Frame layout for the Java interpreter on PPC64. |
197 | |
198 #ifndef CC_INTERP | |
199 // Frame layout for the Java template interpreter on PPC64. | |
200 // | |
201 // Diffs to the CC_INTERP are marked with 'X'. | |
202 // | |
203 // TOP_IJAVA_FRAME: | |
204 // | |
205 // 0 [TOP_IJAVA_FRAME_ABI] | |
206 // alignment (optional) | |
207 // [operand stack] | |
208 // [monitors] (optional) | |
209 // X[IJAVA_STATE] | |
210 // note: own locals are located in the caller frame. | |
211 // | |
212 // PARENT_IJAVA_FRAME: | |
213 // | |
214 // 0 [PARENT_IJAVA_FRAME_ABI] | |
215 // alignment (optional) | |
216 // [callee's Java result] | |
217 // [callee's locals w/o arguments] | |
218 // [outgoing arguments] | |
219 // [used part of operand stack w/o arguments] | |
220 // [monitors] (optional) | |
221 // X[IJAVA_STATE] | |
222 // | |
223 | |
224 struct parent_ijava_frame_abi : abi_minframe { | |
225 }; | |
226 | |
227 enum { | |
228 parent_ijava_frame_abi_size = sizeof(parent_ijava_frame_abi) | |
229 }; | |
230 | |
231 #define _parent_ijava_frame_abi(_component) \ | |
232 (offset_of(frame::parent_ijava_frame_abi, _component)) | |
233 | |
234 struct top_ijava_frame_abi : abi_reg_args { | |
235 }; | |
236 | |
237 enum { | |
238 top_ijava_frame_abi_size = sizeof(top_ijava_frame_abi) | |
239 }; | |
240 | |
241 #define _top_ijava_frame_abi(_component) \ | |
242 (offset_of(frame::top_ijava_frame_abi, _component)) | |
243 | |
244 struct ijava_state { | |
245 #ifdef ASSERT | |
246 uint64_t ijava_reserved; // Used for assertion. | |
247 uint64_t ijava_reserved2; // Inserted for alignment. | |
248 #endif | |
249 uint64_t method; | |
250 uint64_t locals; | |
251 uint64_t monitors; | |
252 uint64_t cpoolCache; | |
253 uint64_t bcp; | |
254 uint64_t esp; | |
255 uint64_t mdx; | |
256 uint64_t top_frame_sp; // Maybe define parent_frame_abi and move there. | |
257 uint64_t sender_sp; | |
258 // Slots only needed for native calls. Maybe better to move elsewhere. | |
259 uint64_t oop_tmp; | |
260 uint64_t lresult; | |
261 uint64_t fresult; | |
262 // Aligned to frame::alignment_in_bytes (16). | |
263 }; | |
264 | |
265 enum { | |
266 ijava_state_size = sizeof(ijava_state) | |
267 }; | |
268 | |
269 #define _ijava_state_neg(_component) \ | |
270 (int) (-frame::ijava_state_size + offset_of(frame::ijava_state, _component)) | |
271 | |
272 #else // CC_INTERP: | |
273 | |
274 // Frame layout for the Java C++ interpreter on PPC64. | |
275 // | 199 // |
276 // This frame layout provides a C-like frame for every Java frame. | 200 // This frame layout provides a C-like frame for every Java frame. |
277 // | 201 // |
278 // In these figures the stack grows upwards, while memory grows | 202 // In these figures the stack grows upwards, while memory grows |
279 // downwards. Square brackets denote regions possibly larger than | 203 // downwards. Square brackets denote regions possibly larger than |
316 // [callee's locals w/o arguments] | 240 // [callee's locals w/o arguments] |
317 // [outgoing arguments] | 241 // [outgoing arguments] |
318 // [ENTRY_FRAME_LOCALS] | 242 // [ENTRY_FRAME_LOCALS] |
319 // | 243 // |
320 // PARENT_IJAVA_FRAME_ABI: | 244 // PARENT_IJAVA_FRAME_ABI: |
321 // 0 [ABI_MINFRAME] | 245 // 0 [ABI_48] |
322 // top_frame_sp | 246 // top_frame_sp |
323 // initial_caller_sp | 247 // initial_caller_sp |
324 // | 248 // |
325 // TOP_IJAVA_FRAME_ABI: | 249 // TOP_IJAVA_FRAME_ABI: |
326 // 0 [PARENT_IJAVA_FRAME_ABI] | 250 // 0 [PARENT_IJAVA_FRAME_ABI] |
332 // frame_manager_lr | 256 // frame_manager_lr |
333 // | 257 // |
334 | 258 |
335 // PARENT_IJAVA_FRAME_ABI | 259 // PARENT_IJAVA_FRAME_ABI |
336 | 260 |
337 struct parent_ijava_frame_abi : abi_minframe { | 261 struct parent_ijava_frame_abi : abi_48 { |
338 // SOE registers. | 262 // SOE registers. |
339 // C2i adapters spill their top-frame stack-pointer here. | 263 // C2i adapters spill their top-frame stack-pointer here. |
340 uint64_t top_frame_sp; // carg_1 | 264 uint64_t top_frame_sp; // carg_1 |
341 // Sp of calling compiled frame before it was resized by the c2i | 265 // Sp of calling compiled frame before it was resized by the c2i |
342 // adapter or sp of call stub. Does not contain a valid value for | 266 // adapter or sp of call stub. Does not contain a valid value for |
359 uint64_t card_4_unused; //_16 carg_4 | 283 uint64_t card_4_unused; //_16 carg_4 |
360 uint64_t carg_5_unused; // carg_5 | 284 uint64_t carg_5_unused; // carg_5 |
361 uint64_t carg_6_unused; //_16 carg_6 | 285 uint64_t carg_6_unused; //_16 carg_6 |
362 uint64_t carg_7_unused; // carg_7 | 286 uint64_t carg_7_unused; // carg_7 |
363 // Use arg8 for storing frame_manager_lr. The size of | 287 // Use arg8 for storing frame_manager_lr. The size of |
364 // top_ijava_frame_abi must match abi_reg_args. | 288 // top_ijava_frame_abi must match abi_112. |
365 uint64_t frame_manager_lr; //_16 carg_8 | 289 uint64_t frame_manager_lr; //_16 carg_8 |
366 // nothing to add here! | 290 // nothing to add here! |
367 // aligned to frame::alignment_in_bytes (16) | 291 // aligned to frame::alignment_in_bytes (16) |
368 }; | 292 }; |
369 | 293 |
371 top_ijava_frame_abi_size = sizeof(top_ijava_frame_abi) | 295 top_ijava_frame_abi_size = sizeof(top_ijava_frame_abi) |
372 }; | 296 }; |
373 | 297 |
374 #define _top_ijava_frame_abi(_component) \ | 298 #define _top_ijava_frame_abi(_component) \ |
375 (offset_of(frame::top_ijava_frame_abi, _component)) | 299 (offset_of(frame::top_ijava_frame_abi, _component)) |
376 | |
377 #endif // CC_INTERP | |
378 | 300 |
379 // ENTRY_FRAME | 301 // ENTRY_FRAME |
380 | 302 |
381 struct entry_frame_locals { | 303 struct entry_frame_locals { |
382 uint64_t call_wrapper_address; | 304 uint64_t call_wrapper_address; |
471 | 393 |
472 // Accessors for fields | 394 // Accessors for fields |
473 intptr_t* fp() const { return _fp; } | 395 intptr_t* fp() const { return _fp; } |
474 | 396 |
475 // Accessors for ABIs | 397 // Accessors for ABIs |
476 inline abi_minframe* own_abi() const { return (abi_minframe*) _sp; } | 398 inline abi_48* own_abi() const { return (abi_48*) _sp; } |
477 inline abi_minframe* callers_abi() const { return (abi_minframe*) _fp; } | 399 inline abi_48* callers_abi() const { return (abi_48*) _fp; } |
478 | 400 |
479 private: | 401 private: |
480 | 402 |
481 // Find codeblob and set deopt_state. | 403 // Find codeblob and set deopt_state. |
482 inline void find_codeblob_and_set_pc_and_deopt_state(address pc); | 404 inline void find_codeblob_and_set_pc_and_deopt_state(address pc); |
497 public: | 419 public: |
498 | 420 |
499 #ifdef CC_INTERP | 421 #ifdef CC_INTERP |
500 // Additional interface for interpreter frames: | 422 // Additional interface for interpreter frames: |
501 inline interpreterState get_interpreterState() const; | 423 inline interpreterState get_interpreterState() const; |
502 #else | |
503 inline ijava_state* get_ijava_state() const; | |
504 // Some convenient register frame setters/getters for deoptimization. | |
505 inline intptr_t* interpreter_frame_esp() const; | |
506 inline void interpreter_frame_set_cpcache(ConstantPoolCache* cp); | |
507 inline void interpreter_frame_set_esp(intptr_t* esp); | |
508 inline void interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp); | |
509 inline void interpreter_frame_set_sender_sp(intptr_t* sender_sp); | |
510 #endif // CC_INTERP | 424 #endif // CC_INTERP |
511 | 425 |
512 // Size of a monitor in bytes. | 426 // Size of a monitor in bytes. |
513 static int interpreter_frame_monitor_size_in_bytes(); | 427 static int interpreter_frame_monitor_size_in_bytes(); |
514 | 428 |