mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8005031: Some cleanup in c2 to prepare for incremental inlining support
Collection of small changes to prepare for incremental inlining. Reviewed-by: twisti, kvn
This commit is contained in:
parent
fb74718339
commit
b1c3e5ccc6
14 changed files with 221 additions and 96 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "code/debugInfoRec.hpp"
|
||||
#include "code/exceptionHandlerTable.hpp"
|
||||
#include "compiler/compilerOracle.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "libadt/dict.hpp"
|
||||
#include "libadt/port.hpp"
|
||||
#include "libadt/vectset.hpp"
|
||||
|
@ -369,6 +370,61 @@ class Compile : public Phase {
|
|||
GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after
|
||||
// main parsing has finished.
|
||||
|
||||
// Inlining may not happen in parse order which would make
|
||||
// PrintInlining output confusing. Keep track of PrintInlining
|
||||
// pieces in order.
|
||||
class PrintInliningBuffer : public ResourceObj {
|
||||
private:
|
||||
CallGenerator* _cg;
|
||||
stringStream* _ss;
|
||||
|
||||
public:
|
||||
PrintInliningBuffer()
|
||||
: _cg(NULL) { _ss = new stringStream(); }
|
||||
|
||||
stringStream* ss() const { return _ss; }
|
||||
CallGenerator* cg() const { return _cg; }
|
||||
void set_cg(CallGenerator* cg) { _cg = cg; }
|
||||
};
|
||||
|
||||
GrowableArray<PrintInliningBuffer>* _print_inlining_list;
|
||||
int _print_inlining;
|
||||
|
||||
public:
|
||||
|
||||
outputStream* print_inlining_stream() const {
|
||||
return _print_inlining_list->at(_print_inlining).ss();
|
||||
}
|
||||
|
||||
void print_inlining_skip(CallGenerator* cg) {
|
||||
if (PrintInlining) {
|
||||
_print_inlining_list->at(_print_inlining).set_cg(cg);
|
||||
_print_inlining++;
|
||||
_print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer());
|
||||
}
|
||||
}
|
||||
|
||||
void print_inlining_insert(CallGenerator* cg) {
|
||||
if (PrintInlining) {
|
||||
for (int i = 0; i < _print_inlining_list->length(); i++) {
|
||||
if (_print_inlining_list->at(i).cg() == cg) {
|
||||
_print_inlining_list->insert_before(i+1, PrintInliningBuffer());
|
||||
_print_inlining = i+1;
|
||||
_print_inlining_list->at(i).set_cg(NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
|
||||
void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
|
||||
stringStream ss;
|
||||
CompileTask::print_inlining(&ss, method, inline_level, bci, msg);
|
||||
print_inlining_stream()->print(ss.as_string());
|
||||
}
|
||||
|
||||
private:
|
||||
// Matching, CFG layout, allocation, code generation
|
||||
PhaseCFG* _cfg; // Results of CFG finding
|
||||
bool _select_24_bit_instr; // We selected an instruction with a 24-bit result
|
||||
|
@ -591,7 +647,7 @@ class Compile : public Phase {
|
|||
void reset_dead_node_list() { _dead_node_list.Reset();
|
||||
_dead_node_count = 0;
|
||||
}
|
||||
uint live_nodes() {
|
||||
uint live_nodes() const {
|
||||
int val = _unique - _dead_node_count;
|
||||
assert (val >= 0, err_msg_res("number of tracked dead nodes %d more than created nodes %d", _unique, _dead_node_count));
|
||||
return (uint) val;
|
||||
|
@ -702,7 +758,7 @@ class Compile : public Phase {
|
|||
|
||||
void identify_useful_nodes(Unique_Node_List &useful);
|
||||
void update_dead_node_list(Unique_Node_List &useful);
|
||||
void remove_useless_nodes (Unique_Node_List &useful);
|
||||
void remove_useless_nodes (Unique_Node_List &useful);
|
||||
|
||||
WarmCallInfo* warm_calls() const { return _warm_calls; }
|
||||
void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; }
|
||||
|
@ -711,6 +767,8 @@ class Compile : public Phase {
|
|||
// Record this CallGenerator for inlining at the end of parsing.
|
||||
void add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); }
|
||||
|
||||
void dump_inlining();
|
||||
|
||||
// Matching, CFG layout, allocation, code generation
|
||||
PhaseCFG* cfg() { return _cfg; }
|
||||
bool select_24_bit_instr() const { return _select_24_bit_instr; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue