[Patch] 8210853: C2 doesn't skip post barrier for new allocated objects

Tobias Hartmann tobias.hartmann at oracle.com
Thu Sep 20 15:22:07 UTC 2018


Hi,

isn't this code executed during parsing and therefore it could happen that more inputs are added to
the region? For example, by Parse::Block::add_new_path():
http://hg.openjdk.java.net/jdk/jdk/file/75e4ce0fa1ba/src/hotspot/share/opto/parse1.cpp#l1917

Best regards,
Tobias

On 18.09.2018 09:33, Kuai Wei wrote:
> 
> Hi,
> 
>   I made a patch to https://bugs.openjdk.java.net/browse/JDK-8210853 . Could you help review my change?
> 
> Background:
>   C2 could remove G1 post barrier if store to new allocated object. But the check of
> just_allocated_object will be prevent by a Region node which is created when inline initialize
> method of super class. The change is to check the pattern and skip the Region node.
> 
> src/hotspot/share/opto/graphKit.cpp
> 
>  // 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)
> +  Node * ctrl = current_control;
> +  // Object::<init> 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 (ctrl != NULL && ctrl->is_Region() && ctrl->req() == 2) {
> +    ctrl = ctrl->in(1);
> +  }
> +  if (C->recent_alloc_ctl() == ctrl)
>      return C->recent_alloc_obj();
>    return NULL;
>  }


More information about the hotspot-compiler-dev mailing list