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

Kuai Wei kuaiwei.kw at alibaba-inc.com
Mon Sep 24 06:06:11 UTC 2018


Hi Tobias,

  Thanks for your suggestion. I think your point is the region node may have new path in later parse phase, so we can not make sure the region node will be optimized.

  It's a good question and I checked it. Now I think it may not cause trouble. In post barrier reduce, the oop store use allocation node as base pointer. The data graph guarantee control of allocation node should dominate control of store. If allocation node is in pred of region node and there's a new path into region, the graph is bad because we can reach store without allocation. If allocation node is in a domination ancestor, the graph shape is a little complicated, so we can not reach control of allocation by skipping one region.

  The better solution is we can know the region node is created in exit_map and we will not change it in later. Is there any way to know it in compile time?

Thanks,
Kevin



------------------------------------------------------------------
发件人:Tobias Hartmann <tobias.hartmann at oracle.com>
发送时间:2018年9月20日(星期四) 23:22
收件人:蒯微(麦庶) <kuaiwei.kw at alibaba-inc.com>; hotspot compiler <hotspot-compiler-dev at openjdk.java.net>
主 题:Re: [Patch] 8210853: C2 doesn't skip post barrier for new allocated objects

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;
>  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20180924/921b9218/attachment-0001.html>


More information about the hotspot-compiler-dev mailing list