API to create a new Allocate node?

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Apr 28 20:55:51 UTC 2022


We don't have specialized code which insert Alloacte node into random place.
Do you have correct jvm state at the point of insertion (to deoptimize correctly if needed)?

Did you look on examples in `PhaseStringOpts::replace_string_concat`?:

https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/stringopts.cpp#L1746
There is call to `new_instance()` at line 2032. But it works only by replacing existing call node `kit.replace_call()`.

I suggest to clone original Allocate node (if you have it) and adjust its edges (input and outputs) if needed.

Thanks,
Vladimir K

On 4/28/22 1:24 PM, Cesar Soares Lucas wrote:
> Hi there!
> 
> I have a quick question. I'm trying to implement an optimization idea in C2 and it requires me to insert Allocate nodes in some places in the IR graph. I'm wondering if there is already a method that I can use that creates the node and adds the necessary edges to surrounding nodes. I tried to use GraphKit::new_instance but after some failed attempts I got the impression that that class is not guaranteed to work outside the parsing phase.
> 
> 
> Any advice would be appreciated.
> Cesar


More information about the hotspot-compiler-dev mailing list