Skip to content

Commit 2c3973a

Browse files
committed
8225653: Provide more information when hitting SIGILL from HaltNode
Add information string for each HaltNode which is printed if hit at runtime. Reviewed-by: vlivanov, thartmann
1 parent 51b0eab commit 2c3973a

File tree

12 files changed

+21
-12
lines changed

12 files changed

+21
-12
lines changed

src/hotspot/cpu/x86/x86.ad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ instruct ShouldNotReachHere() %{
20972097
match(Halt);
20982098
format %{ "ud2\t# ShouldNotReachHere" %}
20992099
ins_encode %{
2100-
__ ud2();
2100+
__ stop(_halt_reason);
21012101
%}
21022102
ins_pipe(pipe_slow);
21032103
%}

src/hotspot/share/adlc/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ int main(int argc, char *argv[])
252252
AD.addInclude(AD._CPP_GEN_file, "adfiles", get_basename(AD._HPP_file._name));
253253
AD.addInclude(AD._CPP_GEN_file, "opto/cfgnode.hpp");
254254
AD.addInclude(AD._CPP_GEN_file, "opto/locknode.hpp");
255+
AD.addInclude(AD._CPP_GEN_file, "opto/rootnode.hpp");
255256
AD.addInclude(AD._CPP_MISC_file, "precompiled.hpp");
256257
AD.addInclude(AD._CPP_MISC_file, "adfiles", get_basename(AD._HPP_file._name));
257258
AD.addInclude(AD._CPP_PEEPHOLE_file, "precompiled.hpp");

src/hotspot/share/adlc/output_c.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3937,6 +3937,9 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden
39373937
fprintf(fp_cpp, "%s node->_prob = _leaf->as_If()->_prob;\n", indent);
39383938
fprintf(fp_cpp, "%s node->_fcnt = _leaf->as_If()->_fcnt;\n", indent);
39393939
}
3940+
if (inst->is_ideal_halt()) {
3941+
fprintf(fp_cpp, "%s node->_halt_reason = _leaf->as_Halt()->_halt_reason;\n", indent);
3942+
}
39403943
if (inst->is_ideal_jump()) {
39413944
fprintf(fp_cpp, "%s node->_probs = _leaf->as_Jump()->_probs;\n", indent);
39423945
}

src/hotspot/share/opto/callnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
14311431
Node *frame = new ParmNode( phase->C->start(), TypeFunc::FramePtr );
14321432
frame = phase->transform(frame);
14331433
// Halt & Catch Fire
1434-
Node *halt = new HaltNode( nproj, frame );
1434+
Node* halt = new HaltNode(nproj, frame, "unexpected negative array length");
14351435
phase->C->root()->add_req(halt);
14361436
phase->transform(halt);
14371437

src/hotspot/share/opto/graphKit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ Node* GraphKit::must_be_not_null(Node* value, bool do_replace_in_map) {
14121412
_gvn.set_type(iff, iff->Value(&_gvn));
14131413
Node *if_f = _gvn.transform(new IfFalseNode(iff));
14141414
Node *frame = _gvn.transform(new ParmNode(C->start(), TypeFunc::FramePtr));
1415-
Node *halt = _gvn.transform(new HaltNode(if_f, frame));
1415+
Node* halt = _gvn.transform(new HaltNode(if_f, frame, "unexpected null in intrinsic"));
14161416
C->root()->add_req(halt);
14171417
Node *if_t = _gvn.transform(new IfTrueNode(iff));
14181418
set_control(if_t);
@@ -2116,7 +2116,7 @@ void GraphKit::uncommon_trap(int trap_request,
21162116
// The debug info is the only real input to this call.
21172117

21182118
// Halt-and-catch fire here. The above call should never return!
2119-
HaltNode* halt = new HaltNode(control(), frameptr());
2119+
HaltNode* halt = new HaltNode(control(), frameptr(), "uncommon trap returned which should never happen");
21202120
_gvn.set_type_bottom(halt);
21212121
root()->add_req(halt);
21222122

src/hotspot/share/opto/loopTransform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* value, Node* pre
12931293
Node *frame = new ParmNode(C->start(), TypeFunc::FramePtr);
12941294
register_new_node(frame, C->start());
12951295
// It's impossible for the predicate to fail at runtime. Use an Halt node.
1296-
Node* halt = new HaltNode(other_proj, frame);
1296+
Node* halt = new HaltNode(other_proj, frame, "duplicated predicate failed which is impossible");
12971297
C->root()->add_req(halt);
12981298
new_iff->set_req(0, prev_proj);
12991299

@@ -2455,7 +2455,7 @@ Node* PhaseIdealLoop::add_range_check_predicate(IdealLoopTree* loop, CountedLoop
24552455
register_control(iftrue, loop->_parent, new_iff);
24562456
Node *frame = new ParmNode(C->start(), TypeFunc::FramePtr);
24572457
register_new_node(frame, C->start());
2458-
Node* halt = new HaltNode(iffalse, frame);
2458+
Node* halt = new HaltNode(iffalse, frame, "range check predicate failed which is impossible");
24592459
register_control(halt, _ltree_root, iffalse);
24602460
C->root()->add_req(halt);
24612461
return iftrue;

src/hotspot/share/opto/loopnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,7 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) {
36513651
Node *frame = new ParmNode( C->start(), TypeFunc::FramePtr );
36523652
_igvn.register_new_node_with_optimizer(frame);
36533653
// Halt & Catch Fire
3654-
Node *halt = new HaltNode( if_f, frame );
3654+
Node* halt = new HaltNode(if_f, frame, "never-taken loop exit reached");
36553655
_igvn.register_new_node_with_optimizer(halt);
36563656
set_loop(halt, l);
36573657
C->root()->add_req(halt);

src/hotspot/share/opto/machnode.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ class MachCallLeafNode: public MachCallRuntimeNode {
10041004
// Machine-specific versions of halt nodes
10051005
class MachHaltNode : public MachReturnNode {
10061006
public:
1007+
const char* _halt_reason;
10071008
virtual JVMState* jvms() const;
10081009
};
10091010

src/hotspot/share/opto/memnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) {
342342
}
343343
}
344344
Node* frame = igvn->transform(new ParmNode(phase->C->start(), TypeFunc::FramePtr));
345-
Node* halt = igvn->transform(new HaltNode(ctl, frame));
345+
Node* halt = igvn->transform(new HaltNode(ctl, frame, "unsafe off-heap access with zero address"));
346346
phase->C->root()->add_req(halt);
347347
return this;
348348
}

src/hotspot/share/opto/node.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class EncodePNode;
7373
class EncodePKlassNode;
7474
class FastLockNode;
7575
class FastUnlockNode;
76+
class HaltNode;
7677
class IfNode;
7778
class IfProjNode;
7879
class IfFalseNode;
@@ -717,8 +718,9 @@ class Node {
717718
DEFINE_CLASS_ID(Mul, Node, 12)
718719
DEFINE_CLASS_ID(Vector, Node, 13)
719720
DEFINE_CLASS_ID(ClearArray, Node, 14)
721+
DEFINE_CLASS_ID(Halt, Node, 15)
720722

721-
_max_classes = ClassMask_ClearArray
723+
_max_classes = ClassMask_Halt
722724
};
723725
#undef DEFINE_CLASS_ID
724726

@@ -749,7 +751,6 @@ class Node {
749751
protected:
750752
// These methods should be called from constructors only.
751753
void init_class_id(jushort c) {
752-
assert(c <= _max_classes, "invalid node class");
753754
_class_id = c; // cast out const
754755
}
755756
void init_flags(jushort fl) {
@@ -822,6 +823,7 @@ class Node {
822823
DEFINE_CLASS_QUERY(EncodePKlass)
823824
DEFINE_CLASS_QUERY(FastLock)
824825
DEFINE_CLASS_QUERY(FastUnlock)
826+
DEFINE_CLASS_QUERY(Halt)
825827
DEFINE_CLASS_QUERY(If)
826828
DEFINE_CLASS_QUERY(RangeCheck)
827829
DEFINE_CLASS_QUERY(IfProj)

0 commit comments

Comments
 (0)