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

Sonia Zaldana Calles szaldana at openjdk.org
Mon Sep 16 18:26:06 UTC 2024


On Mon, 16 Sep 2024 15:35:50 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> Hi all, 
>> 
>> This PR addresses [8336874](https://bugs.openjdk.org/browse/JDK-8336874) ensuring enqueuing an abstract method for compilation doesn't hit an assert with WhiteBox. 
>> 
>> Testing: 
>> - [x] Added test case passes. 
>> 
>> Thanks, 
>> Sonia
>
> 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?

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

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


More information about the hotspot-dev mailing list