# HG changeset patch # User kvn # Date 1540935539 25200 # Node ID 8d87025856520113807e3d83bbc6cd5e604cadef # Parent df10a0cacf3e602c29f3b70fd3b8d41d978d68c3 8210853: JIT: C2 doesn't skip post barrier for new allocated objects Summary: skip copy Region node when look for last allocation Reviewed-by: thartmann, kvn Contributed-by: kuaiwei.kw@alibaba-inc.com diff -r df10a0cacf3e -r 8d8702585652 src/hotspot/share/opto/graphKit.cpp --- a/src/hotspot/share/opto/graphKit.cpp Tue Oct 30 13:48:19 2018 -0400 +++ b/src/hotspot/share/opto/graphKit.cpp Tue Oct 30 14:38:59 2018 -0700 @@ -2116,8 +2116,17 @@ // We use this to determine if an object is so "fresh" that // it does not require card marks. Node* GraphKit::just_allocated_object(Node* current_control) { - if (C->recent_alloc_ctl() == current_control) - return C->recent_alloc_obj(); + Node* ctrl = current_control; + // Object:: is invoked after allocation, most of invoke nodes + // will be reduced, but a region node is kept in parse time, we check + // the pattern and skip the region node if it degraded to a copy. + if (ctrl != NULL && ctrl->is_Region() && ctrl->req() == 2 && + ctrl->as_Region()->is_copy()) { + ctrl = ctrl->as_Region()->is_copy(); + } + if (C->recent_alloc_ctl() == ctrl) { + return C->recent_alloc_obj(); + } return NULL; }