提交 f985c234 编写于 作者: K kvn

7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE

Summary: Fixed several EA issues with Connection Graph construction.
Reviewed-by: never, twisti
上级 9b6cb8d6
...@@ -150,11 +150,23 @@ void BCEscapeAnalyzer::set_method_escape(ArgumentMap vars) { ...@@ -150,11 +150,23 @@ void BCEscapeAnalyzer::set_method_escape(ArgumentMap vars) {
clear_bits(vars, _arg_local); clear_bits(vars, _arg_local);
} }
void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars) { void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) {
clear_bits(vars, _arg_local); clear_bits(vars, _arg_local);
clear_bits(vars, _arg_stack); clear_bits(vars, _arg_stack);
if (vars.contains_allocated()) if (vars.contains_allocated())
_allocated_escapes = true; _allocated_escapes = true;
if (merge && !vars.is_empty()) {
// Merge new state into already processed block.
// New state is not taken into account and
// it may invalidate set_returned() result.
if (vars.contains_unknown() || vars.contains_allocated()) {
_return_local = false;
}
if (vars.contains_unknown() || vars.contains_vars()) {
_return_allocated = false;
}
}
} }
void BCEscapeAnalyzer::set_dirty(ArgumentMap vars) { void BCEscapeAnalyzer::set_dirty(ArgumentMap vars) {
...@@ -999,7 +1011,7 @@ void BCEscapeAnalyzer::merge_block_states(StateInfo *blockstates, ciBlock *dest, ...@@ -999,7 +1011,7 @@ void BCEscapeAnalyzer::merge_block_states(StateInfo *blockstates, ciBlock *dest,
t.set_difference(d_state->_stack[i]); t.set_difference(d_state->_stack[i]);
extra_vars.set_union(t); extra_vars.set_union(t);
} }
set_global_escape(extra_vars); set_global_escape(extra_vars, true);
} }
} }
......
...@@ -81,7 +81,7 @@ class BCEscapeAnalyzer : public ResourceObj { ...@@ -81,7 +81,7 @@ class BCEscapeAnalyzer : public ResourceObj {
bool is_arg_stack(ArgumentMap vars); bool is_arg_stack(ArgumentMap vars);
void clear_bits(ArgumentMap vars, VectorSet &bs); void clear_bits(ArgumentMap vars, VectorSet &bs);
void set_method_escape(ArgumentMap vars); void set_method_escape(ArgumentMap vars);
void set_global_escape(ArgumentMap vars); void set_global_escape(ArgumentMap vars, bool merge = false);
void set_dirty(ArgumentMap vars); void set_dirty(ArgumentMap vars);
void set_modified(ArgumentMap vars, int offs, int size); void set_modified(ArgumentMap vars, int offs, int size);
......
...@@ -1748,7 +1748,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { ...@@ -1748,7 +1748,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
tty->print("%4d ", compile_id); // print compilation number tty->print("%4d ", compile_id); // print compilation number
tty->print("%s ", (is_osr ? "%" : " ")); tty->print("%s ", (is_osr ? "%" : " "));
int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); int code_size = (task->code() == NULL) ? 0 : task->code()->total_size();
tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, time.milliseconds(), task->num_inlined_bytecodes()); tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes());
} }
if (compilable == ciEnv::MethodCompilable_never) { if (compilable == ciEnv::MethodCompilable_never) {
......
此差异已折叠。
...@@ -160,6 +160,7 @@ private: ...@@ -160,6 +160,7 @@ private:
Node* _node; // Ideal node corresponding to this PointsTo node. Node* _node; // Ideal node corresponding to this PointsTo node.
int _offset; // Object fields offsets. int _offset; // Object fields offsets.
bool _scalar_replaceable; // Not escaped object could be replaced with scalar bool _scalar_replaceable; // Not escaped object could be replaced with scalar
bool _has_unknown_ptr; // Has edge to phantom_object
public: public:
PointsToNode(): PointsToNode():
...@@ -168,6 +169,7 @@ public: ...@@ -168,6 +169,7 @@ public:
_edges(NULL), _edges(NULL),
_node(NULL), _node(NULL),
_offset(-1), _offset(-1),
_has_unknown_ptr(false),
_scalar_replaceable(true) {} _scalar_replaceable(true) {}
...@@ -175,6 +177,7 @@ public: ...@@ -175,6 +177,7 @@ public:
NodeType node_type() const { return _type;} NodeType node_type() const { return _type;}
int offset() { return _offset;} int offset() { return _offset;}
bool scalar_replaceable() { return _scalar_replaceable;} bool scalar_replaceable() { return _scalar_replaceable;}
bool has_unknown_ptr() { return _has_unknown_ptr;}
void set_offset(int offs) { _offset = offs;} void set_offset(int offs) { _offset = offs;}
void set_escape_state(EscapeState state) { _escape = state; } void set_escape_state(EscapeState state) { _escape = state; }
...@@ -183,6 +186,7 @@ public: ...@@ -183,6 +186,7 @@ public:
_type = ntype; _type = ntype;
} }
void set_scalar_replaceable(bool v) { _scalar_replaceable = v; } void set_scalar_replaceable(bool v) { _scalar_replaceable = v; }
void set_has_unknown_ptr() { _has_unknown_ptr = true; }
// count of outgoing edges // count of outgoing edges
uint edge_count() const { return (_edges == NULL) ? 0 : _edges->length(); } uint edge_count() const { return (_edges == NULL) ? 0 : _edges->length(); }
...@@ -250,6 +254,8 @@ private: ...@@ -250,6 +254,8 @@ private:
} }
uint nodes_size() const { return _nodes.length(); } uint nodes_size() const { return _nodes.length(); }
bool is_null_ptr(uint idx) const { return (idx == _noop_null || idx == _oop_null); }
// Add node to ConnectionGraph. // Add node to ConnectionGraph.
void add_node(Node *n, PointsToNode::NodeType nt, PointsToNode::EscapeState es, bool done); void add_node(Node *n, PointsToNode::NodeType nt, PointsToNode::EscapeState es, bool done);
...@@ -333,10 +339,9 @@ private: ...@@ -333,10 +339,9 @@ private:
} }
// Notify optimizer that a node has been modified // Notify optimizer that a node has been modified
// Node: This assumes that escape analysis is run before
// PhaseIterGVN creation
void record_for_optimizer(Node *n) { void record_for_optimizer(Node *n) {
_igvn->_worklist.push(n); _igvn->_worklist.push(n);
_igvn->add_users_to_worklist(n);
} }
// Set the escape state of a node // Set the escape state of a node
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册