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