[jdk18] RFR: 8278413: C2 crash when allocating array of size too large

Roland Westrelin roland at openjdk.java.net
Thu Dec 16 12:35:55 UTC 2021


On Thu, 16 Dec 2021 10:21:31 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:

> Here you do:
> 
> ```
> Node* valid_length_test = call->in(AllocateNode::ValidLengthTest);
> const Type* valid_length_test_t = phase->type(valid_length_test);
> if (valid_length_test_t->isa_int() && valid_length_test_t->is_int()->is_con(0)) {
> ```
> 
> But in compile.cpp:3766 you do:
> 
> ```
> Node* valid_length_test = call->in(call->req());
> call->rm_prec(call->req());
> if (valid_length_test->find_int_con(1) == 0) {
> ```
> 
> Why "call->req()" and not "call->in(AllocateNode::ValidLengthTest)"?

call->in(AllocateNode::ValidLengthTest) only works for allocateArrayNode. The code I modified in compile.cpp runs after macro expansion so there's no AllocateArrayNode anymore. Instead there's a call to the runtime. When the AllocateArrayNode is macro expanded I move in(AllocateNode::ValidLengthTest) to the new runtime call as a precedence edge that is at req(). I tried adding it as an extra parameter that would be removed in compile.cpp but that messed up debug infos and I hit some asserts.

> > And why not "if (valid_length_test->find_int_con(1) == 0) {" in both places?

So`that the Value() call does the right thing during CCP where a node can be registered as a constant but not transformed yet to a ConNode.

-------------

PR: https://git.openjdk.java.net/jdk18/pull/30


More information about the hotspot-compiler-dev mailing list