RFR: 8332442: C2: refactor Mod cases in Compile::final_graph_reshaping_main_switch() [v2]
Roland Westrelin
roland at openjdk.org
Tue Sep 10 14:57:08 UTC 2024
On Tue, 10 Sep 2024 14:41:34 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:
>> I don't mind using `Op_DivModIL(...)` but what happens if you remove `Op_DivMod`?
>
> I would end up with some linker error:
>
> /usr/bin/ld: /path/to/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/libjvm/objs/divnode.o: in function `DivModNode::DivModNode(Node*, Node*, Node*)':
> /path/to/jdk/src/hotspot/share/opto/divnode.cpp:1357:(.text+0x7e99): undefined reference to `vtable for DivModNode'
>
>
> It looks like all nodes (even those abstract ones like `Multi` and `Op_Multi`) is processed with `macro` and added to the enum. I don't know why but I looks intentional.
I think that's because `DivModNode` has a virtual method `Opcode()` that's defined by `macro`. Removing the `Op_DivMod` line removes the virtual method definition but the declaration is still there. So removing `Op_DivMod` requires removing the `Opcode()` declaration in the `DivModNode` class. Anyway, that can be cleaned up in a separate PR if needed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20877#discussion_r1752145910
More information about the hotspot-compiler-dev
mailing list