Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail_Frame.hpp @ 18710:4836c2abc884
mx: removed hard-coded -Xms setting for the 'build' and 'checkstyle' commands to try and avoid unnecessary swapping on low(er) memory machines
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 18 Dec 2014 12:12:04 +1000 |
parents | e9998e2be7f5 |
children |
rev | line source |
---|---|
15544 | 1 /* |
2 * Copyright (c) 2014, 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 * | |
23 */ | |
24 | |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
15545
diff
changeset
|
25 #ifndef GPU_HSAIL_VM_GPU_HSAIL_FRAME_HPP |
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
15545
diff
changeset
|
26 #define GPU_HSAIL_VM_GPU_HSAIL_FRAME_HPP |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 #include "graal/graalEnv.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 #include "code/debugInfo.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 #include "code/location.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 |
15545
9d456ffc6120
HSAIL: fixed Windows build
Doug Simon <doug.simon@oracle.com>
parents:
15544
diff
changeset
|
32 class HSAILFrame VALUE_OBJ_CLASS_SPEC { |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 friend class VMStructs; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 private: |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 jint _pc_offset; // The HSAIL "pc_offset" where the exception happens |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 jbyte _num_s_regs; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 jbyte _num_d_regs; |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
38 jshort _num_stack_slots; |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
16242
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
40 jbyte* data_start() {return (jbyte*) this + sizeof(*this); } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
41 int sreg_ofst_start() { return 0; } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
42 int dreg_ofst_start() { return sreg_ofst_start() + num_s_regs() * sizeof(jint); } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
43 int stackslot_ofst_start() { return dreg_ofst_start() + num_d_regs() * sizeof(jlong); } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
44 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
45 int sreg_ofst(int idx) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
46 assert(idx >= 0 && idx < num_s_regs(), "bad sreg index"); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
47 return sreg_ofst_start() + idx * sizeof(jint); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
48 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
49 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
50 int dreg_ofst(int idx) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
51 assert(idx >= 0 && idx < num_d_regs(), "bad dreg index"); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
52 return dreg_ofst_start() + idx * sizeof(jlong); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
53 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
54 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
55 int stackslot_ofst(int stackOffset) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
56 assert(stackOffset >= 0 && (unsigned int) stackOffset < num_stack_slots() * sizeof(jlong), "bad stackoffset"); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
57 return stackslot_ofst_start() + stackOffset; |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
58 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
59 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
60 // the _ptr versions just return a pointer to the indicated d reg or stackslot64 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
61 // some of these are used for oops_do processing |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
62 jint* get_s_reg_ptr(int idx) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
63 return((jint*) (data_start() + sreg_ofst(idx))); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
64 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
65 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
66 jlong* get_d_reg_ptr(int idx) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
67 return((jlong*) (data_start() + dreg_ofst(idx))); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
68 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
69 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
70 jlong* get_stackslot64_ptr(int stackOffset) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
71 return((jlong*) (data_start() + stackslot_ofst(stackOffset))); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
72 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
73 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
74 jint* get_stackslot32_ptr(int stackOffset) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
75 return((jint*) (data_start() + stackslot_ofst(stackOffset))); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
76 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
77 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
78 void* get_oop_ptr_for_bit(int bit) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
79 void* oop_ptr; |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
80 if (bit < num_d_regs()) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
81 // d register |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
82 oop_ptr = (void*) get_d_reg_ptr(bit); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
83 } else { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
84 // stack slot |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
85 int stackOffset = (bit - num_d_regs()) * 8; // 8 bytes per stack slot |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
86 oop_ptr = (void*) get_stackslot64_ptr(stackOffset); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
87 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
88 return oop_ptr; |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
89 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
90 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 public: |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 // Accessors |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 jint pc_offset() { return _pc_offset; } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 jint num_s_regs() {return _num_s_regs; } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 jint num_d_regs() {return _num_d_regs; } |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
96 jint num_stack_slots() {return _num_stack_slots; } |
16242
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
97 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
98 jlong get_oop_for_bit(int bit) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
99 return * (jlong *) get_oop_ptr_for_bit(bit); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 } |
16242
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
101 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
102 // do the oops from this frame |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
103 void oops_do(OopClosure* f, HSAILOopMapHelper* oopMapHelper) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
104 int oops_per_deopt = num_d_regs() + num_stack_slots(); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
105 |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
106 // handle the dregister and stackSlot based oops |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
107 for (int bit = 0; bit < oops_per_deopt; bit++) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
108 if (oopMapHelper->is_oop(pc_offset(), bit)) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
109 void* oop_ptr = get_oop_ptr_for_bit(bit); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
110 // the oops we are dealing with here in the hsailFrame are always uncompressed |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
111 oop old_oop = oopDesc::load_heap_oop((oop *)oop_ptr); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
112 f->do_oop((oop*) oop_ptr); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
113 if (TraceGPUInteraction) { |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
114 oop new_oop = oopDesc::load_heap_oop((oop *)oop_ptr); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
115 tty->print_cr("bit=%d, oop_ptr=%p, old=%p, new=%p", bit, oop_ptr, (void *)old_oop, (void *)new_oop); |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
116 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
117 } |
e9998e2be7f5
use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16076
diff
changeset
|
118 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 }; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 |
16076
06eedda53e14
HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents:
15545
diff
changeset
|
122 #endif // GPU_HSAIL_VM_GPU_HSAIL_FRAME_HPP |