8046698: assert(false) failed: only Initialize or AddP expected macro.cpp:943
roland.westrelin at oracle.com
Tue Jun 17 15:33:01 UTC 2014
Thanks for reviewing this, Vladimir.
> May be we should return 'this' when anything but CheckCastPP, Initialize, AddP references the raw result of Allocate?
> See lines 2882-2899 in escape.cpp. Returning NULL when the result is referenced in other cases is bad because NULL is indication of it is not used after Initialize (lines 2792-2804 in escape.cpp).
> Could you investigate more? May be add assert to catch all cases. It could be the fix is correct because only Phi nodes could reference it.
I ran ctw, refworkload reference_server, all jtreg tests, and ute’s nsk.stress, vm.compiler, vm.regression, nsk.regression, nsk.monitoring with an assert to catch uses other than CheckCastPP, Initialize, AddP. The only other use I found was a Phi for the test case that this change fixes.
Should I go with this as a fix?
> On 6/13/14 8:31 AM, Roland Westrelin wrote:
>> Because of a try/catch in a loop, a Allocate node is in the loop body while the uses of the results are outside the loop (see test case in webrev). Then loop unswitching clones the loop body (including the Allocate but not the Initialization node and other uses of the result projection) and adds a Phi to connect the Allocate nodes to the loop exit. CallNode::result_cast() doesn’t expect a Phi as output so returns NULL which to the allocation elimination code means no use for the allocation (allocation can be eliminated). The fix changes CallNode::result_cast() so it returns the CallNode when the result projection has a Phi as output which causes the allocation elimination code to skip that allocation. Every call to result_cast() is already followed by a check for is_CheckCastPP() so no other change is needed.
More information about the hotspot-compiler-dev