Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/ci/ciMethodBlocks.hpp
32285 views
1
/*
2
* Copyright (c) 2006, 2010, 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
25
#ifndef SHARE_VM_CI_CIMETHODBLOCKS_HPP
26
#define SHARE_VM_CI_CIMETHODBLOCKS_HPP
27
28
#include "ci/ciMethod.hpp"
29
#include "memory/resourceArea.hpp"
30
#include "utilities/growableArray.hpp"
31
32
33
class ciBlock;
34
35
typedef short ciBlockIndex;
36
37
class ciMethodBlocks : public ResourceObj {
38
private:
39
ciMethod *_method;
40
Arena *_arena;
41
GrowableArray<ciBlock *> *_blocks;
42
ciBlock **_bci_to_block;
43
int _num_blocks;
44
int _code_size;
45
46
void do_analysis();
47
public:
48
ciMethodBlocks(Arena *arena, ciMethod *meth);
49
50
ciBlock *block_containing(int bci);
51
ciBlock *block(int index) { return _blocks->at(index); }
52
ciBlock *make_block_at(int bci);
53
ciBlock *split_block_at(int bci);
54
bool is_block_start(int bci);
55
int num_blocks() { return _num_blocks;}
56
void clear_processed();
57
58
ciBlock *make_dummy_block(); // a block not associated with a bci
59
60
#ifndef PRODUCT
61
void dump();
62
#endif
63
};
64
65
class ciBlock : public ResourceObj {
66
private:
67
int _idx;
68
int _start_bci;
69
int _limit_bci;
70
int _control_bci;
71
uint _flags;
72
int _ex_start_bci;
73
int _ex_limit_bci;
74
#ifndef PRODUCT
75
ciMethod *_method;
76
#endif
77
enum {
78
Processed = (1 << 0),
79
Handler = (1 << 1),
80
MayThrow = (1 << 2),
81
DoesJsr = (1 << 3),
82
DoesRet = (1 << 4),
83
RetTarget = (1 << 5),
84
HasHandler = (1 << 6)
85
};
86
87
88
public:
89
enum {
90
fall_through_bci = -1
91
};
92
93
ciBlock(ciMethod *method, int index, int start_bci);
94
int start_bci() const { return _start_bci; }
95
int limit_bci() const { return _limit_bci; }
96
int control_bci() const { return _control_bci; }
97
int index() const { return _idx; }
98
void set_start_bci(int bci) { _start_bci = bci; }
99
void set_limit_bci(int bci) { _limit_bci = bci; }
100
void set_control_bci(int bci) { _control_bci = bci;}
101
void set_exception_range(int start_bci, int limit_bci);
102
int ex_start_bci() const { return _ex_start_bci; }
103
int ex_limit_bci() const { return _ex_limit_bci; }
104
bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }
105
106
// flag handling
107
bool processed() const { return (_flags & Processed) != 0; }
108
bool is_handler() const { return (_flags & Handler) != 0; }
109
bool may_throw() const { return (_flags & MayThrow) != 0; }
110
bool does_jsr() const { return (_flags & DoesJsr) != 0; }
111
bool does_ret() const { return (_flags & DoesRet) != 0; }
112
bool has_handler() const { return (_flags & HasHandler) != 0; }
113
bool is_ret_target() const { return (_flags & RetTarget) != 0; }
114
void set_processed() { _flags |= Processed; }
115
void clear_processed() { _flags &= ~Processed; }
116
void set_handler() { _flags |= Handler; }
117
void set_may_throw() { _flags |= MayThrow; }
118
void set_does_jsr() { _flags |= DoesJsr; }
119
void clear_does_jsr() { _flags &= ~DoesJsr; }
120
void set_does_ret() { _flags |= DoesRet; }
121
void clear_does_ret() { _flags &= ~DoesRet; }
122
void set_is_ret_target() { _flags |= RetTarget; }
123
void set_has_handler() { _flags |= HasHandler; }
124
void clear_exception_handler() { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }
125
#ifndef PRODUCT
126
ciMethod *method() const { return _method; }
127
void dump();
128
void print_on(outputStream* st) const PRODUCT_RETURN;
129
#endif
130
};
131
132
#endif // SHARE_VM_CI_CIMETHODBLOCKS_HPP
133
134