RFR: 8336874: WhiteBoxAPI: assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native())) failed: cannot compile abstract/native methods

Leonid Mesnik lmesnik at openjdk.org
Mon Sep 16 18:52:11 UTC 2024


On Mon, 16 Sep 2024 18:23:38 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/whitebox/TestCompileAbstractMethod.java line 48:
>> 
>>> 46:         assert m1 != null;
>>> 47:         WHITE_BOX.enqueueMethodForCompilation(m1, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
>>> 48:         if (WHITE_BOX.isMethodCompiled(m1)) {
>> 
>> I think it is better to check that 'enqueueMethodForCompilation' returns false for abstract method additionally.
>> The isMethodCompiled should always returns true even if WB try to push abstract method but it is rejected on later steps.
>
> Hi @lmesnik, Could you help me understand a bit better why `isMethodCompiled` should always return true? I’m cross referencing with what’s implemented in [whitebox.cpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/prims/whitebox.cpp#L854).
> 
> In this case, the method handle for `m1` doesn’t have a `nmethod` so the function returns early on the `nullptr` check. Is this behaviour incorrect?

Sorry, I mistaken. I meant that `isMethodCompiled` should always return false for abstract method. The compiler can't compile it. So this check is fine. But for your fix it is better to check return value of `enqueueMethodForCompilation` as I mentioned.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20973#discussion_r1761687397


More information about the hotspot-dev mailing list