提交 b57f09ec 编写于 作者: C chagedorn

8225653: Provide more information when hitting SIGILL from HaltNode

Summary: Add information string for each HaltNode which is printed if hit at runtime.
Reviewed-by: vlivanov, thartmann
上级 0090856f
......@@ -2040,7 +2040,7 @@ instruct ShouldNotReachHere() %{
match(Halt);
format %{ "ud2\t# ShouldNotReachHere" %}
ins_encode %{
__ ud2();
__ stop(_halt_reason);
%}
ins_pipe(pipe_slow);
%}
......
......@@ -249,6 +249,7 @@ int main(int argc, char *argv[])
AD.addInclude(AD._CPP_GEN_file, "adfiles", get_basename(AD._HPP_file._name));
AD.addInclude(AD._CPP_GEN_file, "opto/cfgnode.hpp");
AD.addInclude(AD._CPP_GEN_file, "opto/locknode.hpp");
AD.addInclude(AD._CPP_GEN_file, "opto/rootnode.hpp");
AD.addInclude(AD._CPP_MISC_file, "precompiled.hpp");
AD.addInclude(AD._CPP_MISC_file, "adfiles", get_basename(AD._HPP_file._name));
AD.addInclude(AD._CPP_PEEPHOLE_file, "precompiled.hpp");
......
......@@ -3937,6 +3937,9 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden
fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent);
fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent);
}
if (inst->is_ideal_halt()) {
fprintf(fp_cpp, "%s node->_halt_reason = _leaf->as_Halt()->_halt_reason;\n", indent);
}
if (inst->is_ideal_jump()) {
fprintf(fp_cpp, "%s node->_probs = _leaf->as_Jump()->_probs;\n", indent);
}
......
......@@ -1431,7 +1431,7 @@ Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node *frame = new ParmNode( phase->C->start(), TypeFunc::FramePtr );
frame = phase->transform(frame);
// Halt & Catch Fire
Node *halt = new HaltNode( nproj, frame );
Node* halt = new HaltNode(nproj, frame, "unexpected negative array length");
phase->C->root()->add_req(halt);
phase->transform(halt);
......
......@@ -1413,7 +1413,7 @@ Node* GraphKit::must_be_not_null(Node* value, bool do_replace_in_map) {
_gvn.set_type(iff, iff->Value(&_gvn));
Node *if_f = _gvn.transform(new IfFalseNode(iff));
Node *frame = _gvn.transform(new ParmNode(C->start(), TypeFunc::FramePtr));
Node *halt = _gvn.transform(new HaltNode(if_f, frame));
Node* halt = _gvn.transform(new HaltNode(if_f, frame, "unexpected null in intrinsic"));
C->root()->add_req(halt);
Node *if_t = _gvn.transform(new IfTrueNode(iff));
set_control(if_t);
......@@ -2113,7 +2113,7 @@ void GraphKit::uncommon_trap(int trap_request,
// The debug info is the only real input to this call.
// Halt-and-catch fire here. The above call should never return!
HaltNode* halt = new HaltNode(control(), frameptr());
HaltNode* halt = new HaltNode(control(), frameptr(), "uncommon trap returned which should never happen");
_gvn.set_type_bottom(halt);
root()->add_req(halt);
......
......@@ -1248,7 +1248,7 @@ Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* value, Node* pre
Node *frame = new ParmNode(C->start(), TypeFunc::FramePtr);
register_new_node(frame, C->start());
// It's impossible for the predicate to fail at runtime. Use an Halt node.
Node* halt = new HaltNode(other_proj, frame);
Node* halt = new HaltNode(other_proj, frame, "duplicated predicate failed which is impossible");
C->root()->add_req(halt);
new_iff->set_req(0, prev_proj);
......@@ -2410,7 +2410,7 @@ Node* PhaseIdealLoop::add_range_check_predicate(IdealLoopTree* loop, CountedLoop
register_control(iftrue, loop->_parent, new_iff);
Node *frame = new ParmNode(C->start(), TypeFunc::FramePtr);
register_new_node(frame, C->start());
Node* halt = new HaltNode(iffalse, frame);
Node* halt = new HaltNode(iffalse, frame, "range check predicate failed which is impossible");
register_control(halt, _ltree_root, iffalse);
C->root()->add_req(halt);
return iftrue;
......
......@@ -3596,7 +3596,7 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) {
Node *frame = new ParmNode( C->start(), TypeFunc::FramePtr );
_igvn.register_new_node_with_optimizer(frame);
// Halt & Catch Fire
Node *halt = new HaltNode( if_f, frame );
Node* halt = new HaltNode(if_f, frame, "never-taken loop exit reached");
_igvn.register_new_node_with_optimizer(halt);
set_loop(halt, l);
C->root()->add_req(halt);
......
......@@ -997,6 +997,7 @@ public:
// Machine-specific versions of halt nodes
class MachHaltNode : public MachReturnNode {
public:
const char* _halt_reason;
virtual JVMState* jvms() const;
};
......
......@@ -342,7 +342,7 @@ Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) {
}
}
Node* frame = igvn->transform(new ParmNode(phase->C->start(), TypeFunc::FramePtr));
Node* halt = igvn->transform(new HaltNode(ctl, frame));
Node* halt = igvn->transform(new HaltNode(ctl, frame, "unsafe off-heap access with zero address"));
phase->C->root()->add_req(halt);
return this;
}
......
......@@ -72,6 +72,7 @@ class EncodePNode;
class EncodePKlassNode;
class FastLockNode;
class FastUnlockNode;
class HaltNode;
class IfNode;
class IfProjNode;
class IfFalseNode;
......@@ -717,8 +718,9 @@ public:
DEFINE_CLASS_ID(Mul, Node, 12)
DEFINE_CLASS_ID(Vector, Node, 13)
DEFINE_CLASS_ID(ClearArray, Node, 14)
DEFINE_CLASS_ID(Halt, Node, 15)
_max_classes = ClassMask_ClearArray
_max_classes = ClassMask_Halt
};
#undef DEFINE_CLASS_ID
......@@ -749,7 +751,6 @@ private:
protected:
// These methods should be called from constructors only.
void init_class_id(jushort c) {
assert(c <= _max_classes, "invalid node class");
_class_id = c; // cast out const
}
void init_flags(jushort fl) {
......@@ -821,6 +822,7 @@ public:
DEFINE_CLASS_QUERY(EncodePKlass)
DEFINE_CLASS_QUERY(FastLock)
DEFINE_CLASS_QUERY(FastUnlock)
DEFINE_CLASS_QUERY(Halt)
DEFINE_CLASS_QUERY(If)
DEFINE_CLASS_QUERY(RangeCheck)
DEFINE_CLASS_QUERY(IfProj)
......
......@@ -62,7 +62,8 @@ Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) {
}
//=============================================================================
HaltNode::HaltNode( Node *ctrl, Node *frameptr ) : Node(TypeFunc::Parms) {
HaltNode::HaltNode(Node* ctrl, Node* frameptr, const char* halt_reason) : Node(TypeFunc::Parms), _halt_reason(halt_reason) {
init_class_id(Class_Halt);
Node* top = Compile::current()->top();
init_req(TypeFunc::Control, ctrl );
init_req(TypeFunc::I_O, top);
......
......@@ -51,7 +51,8 @@ public:
// Throw an exception & die
class HaltNode : public Node {
public:
HaltNode( Node *ctrl, Node *frameptr );
const char* _halt_reason;
HaltNode(Node* ctrl, Node* frameptr, const char* halt_reason);
virtual int Opcode() const;
virtual bool pinned() const { return true; };
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册