提交 8a476576 编写于 作者: X Xiaoming Gu 提交者: 云矅

[C2] Backport JDK-8010500: Possible null pointer dereference at...

[C2] Backport JDK-8010500: Possible null pointer dereference at hotspot/src/share/vm/opto/loopnode.hpp

Summary:  Added NULL check for loopnode() in get_pre_loop_end()
Backport the fix for JDK-8010500 (https://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/4e7ee57b57bf) from OpenJDK.

Test Plan: none

Reviewed-by: kuaiwei, luchsh

Issue: https://github.com/alibaba/dragonwell8/issues/13
上级 c7503dc8
...@@ -448,6 +448,7 @@ bool SuperWord::ref_is_alignable(SWPointer& p) { ...@@ -448,6 +448,7 @@ bool SuperWord::ref_is_alignable(SWPointer& p) {
return true; // no induction variable return true; // no induction variable
} }
CountedLoopEndNode* pre_end = get_pre_loop_end(lp()->as_CountedLoop()); CountedLoopEndNode* pre_end = get_pre_loop_end(lp()->as_CountedLoop());
assert(pre_end != NULL, "we must have a correct pre-loop");
assert(pre_end->stride_is_con(), "pre loop stride is constant"); assert(pre_end->stride_is_con(), "pre loop stride is constant");
int preloop_stride = pre_end->stride_con(); int preloop_stride = pre_end->stride_con();
...@@ -2052,7 +2053,7 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { ...@@ -2052,7 +2053,7 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) {
CountedLoopNode *main_head = lp()->as_CountedLoop(); CountedLoopNode *main_head = lp()->as_CountedLoop();
assert(main_head->is_main_loop(), ""); assert(main_head->is_main_loop(), "");
CountedLoopEndNode* pre_end = get_pre_loop_end(main_head); CountedLoopEndNode* pre_end = get_pre_loop_end(main_head);
assert(pre_end != NULL, ""); assert(pre_end != NULL, "we must have a correct pre-loop");
Node *pre_opaq1 = pre_end->limit(); Node *pre_opaq1 = pre_end->limit();
assert(pre_opaq1->Opcode() == Op_Opaque1, ""); assert(pre_opaq1->Opcode() == Op_Opaque1, "");
Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1; Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1;
...@@ -2216,7 +2217,8 @@ CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode *cl) { ...@@ -2216,7 +2217,8 @@ CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode *cl) {
if (!p_f->is_IfFalse()) return NULL; if (!p_f->is_IfFalse()) return NULL;
if (!p_f->in(0)->is_CountedLoopEnd()) return NULL; if (!p_f->in(0)->is_CountedLoopEnd()) return NULL;
CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd(); CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
if (!pre_end->loopnode()->is_pre_loop()) return NULL; CountedLoopNode* loop_node = pre_end->loopnode();
if (loop_node == NULL || !loop_node->is_pre_loop()) return NULL;
return pre_end; return pre_end;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册