RFR: 8351661: NMT: VMATree should support separate call-stacks for reserve and commit operations [v8]

Afshin Zafari azafari at openjdk.org
Tue Apr 8 08:28:16 UTC 2025


On Mon, 7 Apr 2025 15:55:20 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixes. New check_tree impl and visualization.
>
> test/hotspot/gtest/nmt/test_vmatree.cpp line 862:
> 
>> 860:     tree.commit_mapping(25, 25, call_stack_2, true); // commit at the middle of the region
>> 861:     // Pre: post of previous
>> 862:     // Post: .........0---------25*********50--------100.........
> 
> // Pre:  .........0------------------------------100.........
>     // Post: .........0---------25*********50--------100.........

Done

> test/hotspot/gtest/nmt/test_vmatree.cpp line 876:
> 
>> 874:     tree.commit_mapping(0, 20, call_stack_2, true); // commit at the begin of the region
>> 875:     // Pre: post of previous
>> 876:     // Post: .........0********20---------25********50--------100.........
> 
> // Pre:  .........0---------------25*********50--------100.........
>     // Post: .........0********20-----25*********50--------100.........

Done

> test/hotspot/gtest/nmt/test_vmatree.cpp line 890:
> 
>> 888:     tree.commit_mapping(80, 20, call_stack_2, true); // commit at the end of the region
>> 889:     // Pre: post of previous
>> 890:     // Post: .........0********20---------25********50--------80********100.........
> 
> // Pre:  .........0********20-----25*********50------------------100.........
>     // Post: .........0********20-----25*********50--------80********100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 920:
> 
>> 918:     tree.commit_mapping(20, 20, call_stack_2, true);
>> 919:     // Pre: post of previous
>> 920:     // Post: .........0---------20********40-------100.........
> 
> // Pre:  .........0----------------------------100.........
>     // Post: .........0---------20********40-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 937:
> 
>> 935:     tree.commit_mapping(10, 20, call_stack_3);
>> 936:     // Pre: post of previous
>> 937:     // Post: .........0---------10********30********40-------100.........
> 
> // Pre:  .........0---------20**************40-------100.........
>     // Post: .........0---10*********30*********40-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 954:
> 
>> 952:     tree.commit_mapping(30, 20, call_stack_4);
>> 953:     // Pre: post of previous
>> 954:     // Post: .........0---------10********30********50-------100.........
> 
> // Pre:  .........0---------10********30*********40------------------100.........
>     // Post: .........0---------10********30********************50-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 975:
> 
>> 973: 
>> 974:     tree.uncommit_mapping(0, 5, call_stack_2);
>> 975:     // Pre:  .........0********10--------20********40-------100.........
> 
> // Pre:  .........0***********10--------20********40-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 980:
> 
>> 978:     //        -         si_1      si_1      si_1      si_1      -
>> 979:     //        -         si_2      -         si_2      -         -
>> 980:     // Post: .........0--------5********10--------20********40-------100.........
> 
> // Post: .........0-----5*****10--------20********40-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 994:
> 
>> 992:     tree.uncommit_mapping(20, 10, call_stack_2);
>> 993:     // Pre: post of previous
>> 994:     // Post: .........0--------5********10--------30********40-------100.........
> 
> // Pre:  .........0-----5*****10--------20****************40-------100.........
>     // Post: .........0-----5*****10----------------30********40-------100.........

Done.

> test/hotspot/gtest/nmt/test_vmatree.cpp line 1005:
> 
>> 1003:                            {-1    , -1    , si_2  , -1    , si_2  , -1    , -1    }};
>> 1004:     check_tree(tree, et2, __LINE__);
>> 1005:   }
> 
> If I add this operation here, I get `SIGSEGV`:
> 
> 
>     tree.uncommit_mapping(20, 30, call_stack_2);
>     // Pre:  .........0-----5*****10----------------30********40-------100.........
>     // Post: .........0-----5*****10-----------------------------------100.........
>     //        mtNone    mtTest   mtTest    mtTest    mtTest    mtTest    mtNone
>     //        Rl        Rs       C         Rs        C         Rs        Rl
>     //        -         si_1     si_1      si_1      si_1      si_1      -
>     //        -         -        si_2      -         si_2      -         -
>     ExpectedTree<6> et3 = {{     0,     5,      10,    100        },
>                            {mtNone, mtTest, mtTest, mtTest, mtNone},
>                            {Rl    , Rs    , C     , Rs    , Rl    },
>                            {-1    , si_1  , si_1  , si_1  , -1    },
>                            {-1    , -1    , si_2  , -1    , -1    }};
>     check_tree(tree, et3, __LINE__);
> 
> 
> 
> 
> signaled: SIGSEGV
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  SIGSEGV (0xb) at pc=0x000000010548f42c, pid=7015, tid=259
> #
> # JRE version: OpenJDK Runtime Environment (25.0) (build 25-internal-adhoc.gerard.jdk)
> # Java VM: OpenJDK 64-Bit Server VM (25-internal-adhoc.gerard.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
> # Problematic frame:
> # V  [libjvm.dylib+0x2ab42c]  void check_tree<6>(VMATree&, ExpectedTree<6> const&, int)+0x558

The template parameter `N` to `ExpectedTree<N>` is the number of nodes. In this code, `6` is passed as `N` but `4` nodes (`0, 5, 10, 100`) are provided. The `ExpectedTree<4> et3 = ...` should fix it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032660708
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032661050
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032661256
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032661728
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032661978
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032662309
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032662770
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032662999
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032663255
PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2032667619


More information about the hotspot-runtime-dev mailing list