1 /*
2 * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef CPU_ZERO_FRAME_ZERO_HPP
27 #define CPU_ZERO_FRAME_ZERO_HPP
28
29 // A frame represents a physical stack frame on the Zero stack.
30
31 public:
32 enum {
33 pc_return_offset = 0,
34 metadata_words = 0,
35 // size, in words, of metadata at frame bottom, i.e. it is not part of the
36 // caller/callee overlap
37 metadata_words_at_bottom = metadata_words,
38 // size, in words, of frame metadata at the frame top, i.e. it is located
39 // between a callee frame and its stack arguments, where it is part
40 // of the caller/callee overlap
41 metadata_words_at_top = 0,
42 frame_alignment = 16,
43 // size, in words, of maximum shift in frame position due to alignment
44 align_wiggle = 1
45 };
46
47 // Constructor
48 public:
49 frame(ZeroFrame* zeroframe, intptr_t* sp);
50
51 private:
52 ZeroFrame* _zeroframe;
53
54 public:
55 const ZeroFrame *zeroframe() const {
56 return _zeroframe;
57 }
58
59 intptr_t* fp() const {
60 return (intptr_t *) zeroframe();
61 }
62
63 inline interpreterState get_interpreterState() const;
64
65 public:
66 const EntryFrame *zero_entryframe() const {
67 return zeroframe()->as_entry_frame();
68 }
69 const InterpreterFrame *zero_interpreterframe() const {
70 return zeroframe()->as_interpreter_frame();
71 }
72
73 public:
74 bool is_fake_stub_frame() const;
75
76 public:
77 frame sender_for_nonentry_frame(RegisterMap* map) const;
78
79 public:
80 void zero_print_on_error(int index,
81 outputStream* st,
82 char* buf,
83 int buflen) const;
84
85 static jint interpreter_frame_expression_stack_direction() { return -1; }
86
87 inline address* sender_pc_addr() const;
88
89 template <typename RegisterMapT>
90 static void update_map_with_saved_link(RegisterMapT* map, intptr_t** link_addr);
91
92 intptr_t* repair_sender_sp(intptr_t* sender_sp, intptr_t** saved_fp_addr) const;
93 static intptr_t* repair_sender_sp(nmethod* nm, intptr_t* sp, intptr_t** saved_fp_addr);
94 bool was_augmented_on_entry(int& real_size) const;
95
96 #endif // CPU_ZERO_FRAME_ZERO_HPP