8046698: assert(false) failed: only Initialize or AddP expected macro.cpp:943
vladimir.kozlov at oracle.com
Fri Jun 13 16:10:11 UTC 2014
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.
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