< prev index next >

src/hotspot/cpu/x86/smallRegisterMap_x86.inline.hpp

Print this page

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 CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP
26 #define CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP
27 
28 #include "runtime/frame.inline.hpp"
29 #include "runtime/registerMap.hpp"
30 


31 // Java frames don't have callee saved registers (except for rbp), so we can use a smaller RegisterMap
32 class SmallRegisterMap {
33   constexpr SmallRegisterMap() = default;
34   ~SmallRegisterMap() = default;
35   NONCOPYABLE(SmallRegisterMap);
36 
37 public:
38   static const SmallRegisterMap* instance() {
39     static constexpr SmallRegisterMap the_instance{};
40     return &the_instance;
41   }
42 
43 private:
44   static void assert_is_rbp(VMReg r) NOT_DEBUG_RETURN
45                                      DEBUG_ONLY({ assert(r == rbp->as_VMReg() || r == rbp->as_VMReg()->next(), "Reg: %s", r->name()); })
46 public:
47   // as_RegisterMap is used when we didn't want to templatize and abstract over RegisterMap type to support SmallRegisterMap
48   // Consider enhancing SmallRegisterMap to support those cases
49   const RegisterMap* as_RegisterMap() const { return nullptr; }
50   RegisterMap* as_RegisterMap() { return nullptr; }
51 
52   RegisterMap* copy_to_RegisterMap(RegisterMap* map, intptr_t* sp) const {
53     map->clear();
54     map->set_include_argument_oops(this->include_argument_oops());
55     frame::update_map_with_saved_link(map, (intptr_t**)sp - frame::sender_sp_offset);
56     return map;
57   }
58 
59   inline address location(VMReg reg, intptr_t* sp) const {
60     assert_is_rbp(reg);
61     return (address)(sp - frame::sender_sp_offset);
62   }
63 
64   inline void set_location(VMReg reg, address loc) { assert_is_rbp(reg); }
65 
66   JavaThread* thread() const {
67   #ifndef ASSERT
68     guarantee (false, "unreachable");
69   #endif
70     return nullptr;
71   }
72 
73   bool update_map()    const { return false; }
74   bool walk_cont()     const { return false; }
75   bool include_argument_oops() const { return false; }
76   void set_include_argument_oops(bool f)  {}
77   bool in_cont()       const { return false; }
78   stackChunkHandle stack_chunk() const { return stackChunkHandle(); }
79 
80 #ifdef ASSERT
81   bool should_skip_missing() const  { return false; }
82   VMReg find_register_spilled_here(void* p, intptr_t* sp) { return rbp->as_VMReg(); }
83   void print() const { print_on(tty); }
84   void print_on(outputStream* st) const { st->print_cr("Small register map"); }
85 #endif
86 };
87 
88 #endif // CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP

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 CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP
26 #define CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP
27 
28 #include "runtime/frame.inline.hpp"
29 #include "runtime/registerMap.hpp"
30 
31 class SmallRegisterMap;
32 
33 // Java frames don't have callee saved registers (except for rbp), so we can use a smaller RegisterMap
34 template <bool IncludeArgs>
35 class SmallRegisterMapType {
36   friend SmallRegisterMap;

37 
38   constexpr SmallRegisterMapType() = default;
39   ~SmallRegisterMapType() = default;
40   NONCOPYABLE(SmallRegisterMapType);


41 

42   static void assert_is_rbp(VMReg r) NOT_DEBUG_RETURN
43                                      DEBUG_ONLY({ assert(r == rbp->as_VMReg() || r == rbp->as_VMReg()->next(), "Reg: %s", r->name()); })
44 public:
45   // as_RegisterMap is used when we didn't want to templatize and abstract over RegisterMap type to support SmallRegisterMapType
46   // Consider enhancing SmallRegisterMapType to support those cases
47   const RegisterMap* as_RegisterMap() const { return nullptr; }
48   RegisterMap* as_RegisterMap() { return nullptr; }
49 
50   RegisterMap* copy_to_RegisterMap(RegisterMap* map, intptr_t* sp) const {
51     map->clear();
52     map->set_include_argument_oops(this->include_argument_oops());
53     frame::update_map_with_saved_link(map, (intptr_t**)sp - frame::sender_sp_offset);
54     return map;
55   }
56 
57   inline address location(VMReg reg, intptr_t* sp) const {
58     assert_is_rbp(reg);
59     return (address)(sp - frame::sender_sp_offset);
60   }
61 
62   inline void set_location(VMReg reg, address loc) { assert_is_rbp(reg); }
63 
64   JavaThread* thread() const {
65   #ifndef ASSERT
66     guarantee (false, "unreachable");
67   #endif
68     return nullptr;
69   }
70 
71   bool update_map()    const { return false; }
72   bool walk_cont()     const { return false; }
73   bool include_argument_oops() const { return IncludeArgs; }
74   void set_include_argument_oops(bool f)  {}
75   bool in_cont()       const { return false; }
76   stackChunkHandle stack_chunk() const { return stackChunkHandle(); }
77 
78 #ifdef ASSERT
79   bool should_skip_missing() const  { return false; }
80   VMReg find_register_spilled_here(void* p, intptr_t* sp) { return rbp->as_VMReg(); }
81   void print() const { print_on(tty); }
82   void print_on(outputStream* st) const { st->print_cr("Small register map"); }
83 #endif
84 };
85 
86 #endif // CPU_X86_SMALLREGISTERMAP_X86_INLINE_HPP
< prev index next >